HttpWebRequest timeout in 3.5sp1

2019-08-22 02:17发布

问题:

We have a service that opens several HttpWebRequests. It ran fine under 3.0 until we upgraded the server to .net 3.5sp1. Now we get timeouts while waiting for the request. (we have verified that the endpoint is up and running).

There are a few things that make this interesting. Increasing the number of max connections will let it run for a little longer before the timeouts occur. Also, once we see the requests waiting, if we open Fiddler they all succeed. These requests open via a Timer (which spawns a new thread every time the Elapsed delegate is called) so we could be seeing deadlocking, but the code base hasn't changed and we didn't have this problem under 3.0

I guess my question is, does anyone have any tips on going about to solve this? Has anything changed in the HttpWebRequest in sp1 that would cause us to see this behavior?

回答1:

For archiving purposes here is the solution we found:

Setting the KeepAlive property to false seems to fix the problem, however it does slow down each request a bit.