I am making a post from a .NET console app to a .NET web service. I know that the timeout on the server side is 20 min, but if my client takes more than 100 seconds to post my data to that service then I get a timeout exception. How would I tell my client to wait the available 20 min to timeout?
我正在从.NET控制台应用程序发布到.NET Web服务的帖子。我知道服务器端的超时是20分钟,但是如果我的客户端需要超过100秒才能将数据发布到该服务,那么我会收到超时异常。我怎么告诉我的客户等待可用的20分钟超时?
3 个解决方案
#1
6
on the client side, your webservice object has a timeout value. It should be pretty easy to set by going:
在客户端,您的webservice对象具有超时值。通过去设置应该很容易:
myServiceInstance.Timeout = 1200000
for 20 minutes
20分钟
#2
2
You need to verify that <httpRuntime executionTimeout="1200"/> exists in the web.config on the webservice itself to confirm your 20 minutes.
您需要验证webservice本身的web.config中是否存在
The service proxy class instance in your console app also needs to be set. There is a Timeout property to set (in milliseconds) so you would do something like this:
还需要设置控制台应用程序中的服务代理类实例。有一个Timeout属性设置(以毫秒为单位),所以你会做这样的事情:
MyServiceClass myService = new MyServiceClass(); myService.Timeout = 1200000;
MyServiceClass myService = new MyServiceClass(); myService.Timeout = 1200000;
#3
0
Yup the ServiceInstance.Timeout
is the property to set.
是的,ServiceInstance.Timeout是要设置的属性。
I blogged about it here http://stackpanel.com/blog/2008/10/client-timeout-accessing-asmx-web-service/
我在这里写博客http://stackpanel.com/blog/2008/10/client-timeout-accessing-asmx-web-service/
#1
6
on the client side, your webservice object has a timeout value. It should be pretty easy to set by going:
在客户端,您的webservice对象具有超时值。通过去设置应该很容易:
myServiceInstance.Timeout = 1200000
for 20 minutes
20分钟
#2
2
You need to verify that <httpRuntime executionTimeout="1200"/> exists in the web.config on the webservice itself to confirm your 20 minutes.
您需要验证webservice本身的web.config中是否存在
The service proxy class instance in your console app also needs to be set. There is a Timeout property to set (in milliseconds) so you would do something like this:
还需要设置控制台应用程序中的服务代理类实例。有一个Timeout属性设置(以毫秒为单位),所以你会做这样的事情:
MyServiceClass myService = new MyServiceClass(); myService.Timeout = 1200000;
MyServiceClass myService = new MyServiceClass(); myService.Timeout = 1200000;
#3
0
Yup the ServiceInstance.Timeout
is the property to set.
是的,ServiceInstance.Timeout是要设置的属性。
I blogged about it here http://stackpanel.com/blog/2008/10/client-timeout-accessing-asmx-web-service/
我在这里写博客http://stackpanel.com/blog/2008/10/client-timeout-accessing-asmx-web-service/