WCF中的超时问题

pri*_*kar 9 c# wcf

我在WCF有时间问题.

以下是错误:

{"在00:00之后等待回复时请求通道超时:59.9843744.增加传递给Request的调用的超时值或增加Binding上的SendTimeout值.分配给此操作的时间可能是更长的超时时间."}

在谷歌搜索后,我找到了解决方案

来自这个网站

http://social.msdn.microsoft.com/Forums/en-US/peertopeer/thread/38306972-3128-4f0c-937b-5d162d4d8e74

所以我相应地更改了我的app.config文件

<behavior name="ContactServiceBehaviour">
  <serviceMetadata httpGetEnabled="true" />
  <dataContractSerializer maxItemsInObjectGraph="1000000000"/>
  <serviceDebug includeExceptionDetailInFaults="true" />
  <serviceThrottling    maxConcurrentCalls="100"
                      maxConcurrentSessions="100"
                      maxConcurrentInstances="100"/>
</behavior>
Run Code Online (Sandbox Code Playgroud)

解决办法是什么?

And*_*rry 18

你提到的论坛帖子是红鲱鱼.错误消息明确指出您需要增加WCF客户端和服务中的超时属性.(如果你在服务中更改它,我发现它在更新时并不总是被客户端拾取)

在Visual Studio中,转到"工具"菜单,您将找到"WCF服务配置编辑器".加载项目web.config并为您的服务定义新的Binding.

要更改的设置是SendTimeout值.默认为60秒.

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="WCFBinding" sendTimeout="00:02:00">
    </binding>
  </basicHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)