C# .NET - How can I increase the Webservice-Timeout?

Asked By Bhawana on 19-Jun-12 01:15 AM
Hi All,


I am using axis/services(wsdl) in my window application  and I would like to know, if I can increase the "Timeout" for an specific Webservice?


If it's possible, where and how can I do it?


Thank you very much in advance!


please help me
Jitendra Faye replied to Bhawana on 19-Jun-12 01:33 AM
You can use WebClientProtocol.Timeout Property .

this represents the time an XML Web service client waits for the reply to a synchronous XML Web service request to arrive (in milliseconds).

follow this link-

http://msdn.microsoft.com/en-us/library/system.web.services.protocols.webclientprotocol.timeout.aspx

Hope this will help you.
TSN ... replied to Bhawana on 19-Jun-12 01:58 AM
Firstly, you need to increase the timeout of the executionTimeout attribute of the httpRuntime element. Note that this is mentioned in Seconds unlike the other timeout attributes like the Session timeout and others.

<httpRuntime
executionTimeout="36000"


And moreover, this attribute takes effect only when you set the debug attribute of the Compilation element to false. This is also specified in the MSDN link that you mentioned. Like,

<compilation
debug="false"
../>

But this works in conjunction with the Session timeout. Yes, if the session times out , then an error would be thrown. and it wouldn't wait for the executionTimeout value to take effect. so you also need to set the Session Timeout to a higher value. And note that this is in minutes. which would look like,

<sessionState
mode="InProc"
timeout="360"
...
/>


And note that all of this would be overriden by AppPool recycling process. so you need to set the Idle Timeout value of the Apppool that your website uses to atleast same / higher value than the session timeout.


Refereced Address:  http://www.eggheadcafe.com/community/asp-net/17/10111748/how-can-we-increase-the-timeout-of-a-thread-from-webconfig.aspx
GAURAV KUMAR replied to Bhawana on 19-Jun-12 04:00 AM
hi,
the code to increase timeout is "<httpRuntime executionTimeout="numberof seconds"/>"

it should be written like this:-
<system.web>..
<compilation debug="false"/>
<httpRuntime executionTimeout="1200"/>
</system.web>