Nilzor
Nilzor

Reputation: 18593

Where does the timeout come from when async HttpWebRequests are done in .NET?

For async calls the the request methods of HttpWebRequest, like i.e. BeginGetResponse, the Timeout property is not heeded. Still there seems to be a default timeout for HTTP calls done with this method on my machine on about 20 seconds. Where does this come from? At what level(s) is this timeout configured and where/if can I change it?

In my experimenting I configured the address www.stackoverflow.com:9999 as a proxy server to induce a timeout.

Upvotes: 1

Views: 145

Answers (1)

Tomas Voracek
Tomas Voracek

Reputation: 5914

As always, check docs http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout.aspx

The Timeout property has no effect on asynchronous requests made with the BeginGetResponse or BeginGetRequestStream method.

Edit: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx there is important piece of info:

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing.

Maybe you can try that and figure out what is happening. Also, there is no setting related to 20secs value in HttpRequest, so it may be something OS/driver/DNS specific.

Upvotes: 1

Related Questions