本文介绍了WCF 中的超时问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 WCF 中遇到超时问题.

I am having time out issue in WCF.

错误如下:

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

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

After searching in google, I found the solution

来自本网站

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

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

So I changed accordingly my app.config file

<behavior name="ContactServiceBehaviour">
  <serviceMetadata httpGetEnabled="true" />
  <dataContractSerializer maxItemsInObjectGraph="1000000000"/>
  <serviceDebug includeExceptionDetailInFaults="true" />
  <serviceThrottling    maxConcurrentCalls="100"
                      maxConcurrentSessions="100"
                      maxConcurrentInstances="100"/>
</behavior>

解决方案是什么?

推荐答案

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

The forum post you mention is a red herring. The error message clearly states that you need to increase the timeout property in the WCF client and service. (if you change it in the service I have found that it doesn't always get picked up by the client when it is updated)

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

In Visual studio goto the Tools menu, there you will find the 'WCF Service Configuration Editor'. Load your projects web.config and define a new Binding for your service.

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

The setting to change is the SendTimeout value. It is 60 seconds by default.

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="WCFBinding" sendTimeout="00:02:00">
    </binding>
  </basicHttpBinding>
</bindings>

这篇关于WCF 中的超时问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 12:15
查看更多