.NET Web服务(ASMX)超时的问题 [英] .NET Web Service (asmx) Timeout Problem

查看:741
本文介绍了.NET Web服务(ASMX)超时的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我连接到一个供应商提供的网络服务的ASMX和发送一组数据,通过线路。我第一次尝试打1分钟超时的Visual Studio中投在默认情况下,在app.config文件中,当你添加一个服务引用的项目。予增加它到10分钟,另一超时。 1小时后,另一超时:

I'm connecting to a vendor-supplied web ASMX service and sending a set of data over the wire. My first attempt hit the 1 minute timeout that Visual Studio throws in by default in the app.config file when you add a service reference to a project. I increased it to 10 minutes, another timeout. 1 hour, another timeout:

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部分现在看起来是这样的:

I contacted the vendor. They confirmed the call may take over an hour (don't ask, they are the bane of my existence.) I increased the timeout to 10 hours to be on the safe side. However the web service call continues to time out at 1 hour. The relevant app.config section now looks like this:

   <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>

pretty的荒谬,但无论超时仍在1小时踢研究。不幸的是每一个变化至少需要一小时测试。有一些是我撞到的内部限制 - 另一个超时设置被改变的地方?所有更改这些设置的的1小时取得预期的效果。

Pretty absurd, but regardless the timeout is still kicking in at 1 hour. Unfortunately every change takes at least an additional hour to test. Is there some internal limit that I'm bumping into - another timeout setting to be changed somewhere? All changes to these settings up to one hour had the expected effect.

感谢您的帮助,您可以提供!

Thanks for any help you can provide!

推荐答案

首先: 见史蒂芬程[MSFT]答复这里有关超时。有一个执行超时您可以设置的httpRuntime。他说,以后有事那么有趣,这就是此外,请确保您已设置了编译调试=假以让超时工作的正确

Firstly: See Steven Cheng[MSFT] response here about timeouts. There is a execution timeout you can set for httpRuntime. He says something interesting after that, which is "Also, make sure that you've set the 'compilation debug="false"' as to make the timeout work correctly"

除了事实的东西可能是可怕的错误在他们结束(或返回的数据是如此浩繁的/我不打算去判断 - 可能是一个很好的理由),你有没有打过电话的异步操作?同样的结果?我想这将需要一个小时

Besides the fact that something may be terribly wrong on their end (or the data returned is so voluminous/ I'm not going to judge - might be a good reason), have you tried calling their operation Asynchronously? Same results? I guess it would take an hour

YourVendor.WebService ws = new YourVendor.WebService();
ws.LongRunningOperationCompleted += new YourVendor.LongRunningOperationEventHandler(ws_LongRunningOperationCompleted);

ws.LongRunningOperationAsync();

// Implement the ws_LongRunningOperationCompleted handler (stub will auto generate)

完成的事件处理程序将有一个特定的事件参数参数,其中将包含结果,对事件参数E,e.Result应该有你需要它完成时。

The completed event handler will have a specific event args param, which will contain the results, for event args e, e.Result should have what you need when it completes.

这篇关于.NET Web服务(ASMX)超时的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆