【发布时间】:2011-03-05 02:42:09
【问题描述】:
我正在连接到供应商提供的 Web ASMX 服务并通过网络发送一组数据。当您向项目添加服务引用时,我的第一次尝试达到了 Visual Studio 默认在 app.config 文件中引发的 1 分钟超时。我把它增加到 10 分钟,又一次超时。 1 小时,又一次超时:
Error: System.TimeoutException: The request channel timed out while waiting for
a reply after 00:59:59.6874880. Increase the timeout value passed to the call to
Request or increase the SendTimeout value on the Binding. The time allotted to
this operation may have been a portion of a longer timeout. ---> System.TimeoutE
xception: The HTTP request to 'http://servername/servicename.asmx' has exceeded the allotted timeout of 01:00:00. The time allotted to this
operation may have been a portion of a longer timeout. ---> System.Net.WebExcept
ion: The operation has timed out
at System.Net.HttpWebRequest.GetResponse() [... lengthly stacktrace follows]
我联系了供应商。他们确认通话可能需要一个多小时(不要问,他们是我存在的祸根。)为了安全起见,我将超时时间增加到 10 小时。但是,Web 服务调用在 1 小时后继续超时。相关的 app.config 部分现在如下所示:
<basicHttpBinding>
<binding name="BindingName" closeTimeout="10:00:00"
openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
相当荒谬,但无论如何超时仍然在 1 小时开始。不幸的是,每次更改都需要至少额外的一个小时来测试。我是否遇到了一些内部限制 - 另一个超时设置要在某处更改?对这些设置的所有更改最长一小时都达到了预期效果。
感谢您提供的任何帮助!
【问题讨论】:
-
当它在一小时内启动时,它与您在设置超时时间为 1 分钟时遇到的异常完全相同吗?
标签: .net wcf web-services timeout wcf-client