增加ServicePointManager.DefaultConnectionLimit的缺点 [英] Disadvantage of increasing ServicePointManager.DefaultConnectionLimit
本文介绍了增加ServicePointManager.DefaultConnectionLimit的缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在多线程环境中调用Web服务.我的许多调用由于操作超时或错误请求而失败,但是如果我以线性方式执行操作,则所有调用都不会失败,这意味着调用具有多个线程的Web服务时会出现问题.经过大量分析,我发现并发连接的限制导致了这些异常,因此我通过添加以下代码对其进行了修复.
I am calling a webservice in multi threaded environment. Lot of my calls fail due to operation time out or bad request but none of the calls fail if I do it in linear fashion which means there is problem with invoking webservice with multiple threads. After lot of analysis, I found out that there is limit of concurrent connection which is causing these exception so I fixed it by adding below code.
ServicePointManager.DefaultConnectionLimit = 2 * _ThreadCount;
我不知道是增加此限制的可能缺点.默认情况下,连接限制为2.如果有人知道任何不利之处,请告诉我.
What I dont know is the possible disadvantage of increasing this limit. By default, Connection limit is 2. If anyone knows any disadvantages, please do let me know.
推荐答案
查看全文