开发者

HttpWebRequest limitation?

开发者 https://www.devze.com 2023-03-22 04:30 出处:网络
I created a COM object that makes a query into a website. It\'s works perfectly, but when I use this COM objec开发者_开发百科t with many threads (50 for example), I get many timeout errors, and I chan

I created a COM object that makes a query into a website. It's works perfectly, but when I use this COM objec开发者_开发百科t with many threads (50 for example), I get many timeout errors, and I changed the HttpWebRequest timeout to 45 seconds.

How is that possible?

Is there some limitation in this method? How can I solve this problem?

Thanks!


Since you don't have your code, I could not tell exactly what happened. But this are my assumptions:

  • Firstly, You maxed out the default limit number of connections per application to a web host. By default, the number is 2. You can increase it by looking at this document

  • Secondly, the connections were not terminated properly after you transmitted the data. You can verify those HTTP connections by typing netstat -n if you're on Windows. Look for connections that have the same destination IP (should be). If this is the case, then you need to properly close the HttpWebResponse.GetReponseStream(). This will terminate the HTTP connection quickly.

0

精彩评论

暂无评论...
验证码 换一张
取 消