0

I have implemented a simple HttpRequest client which hits the target website and download the required data. Everything was fine until i moved it be a multi-threaded applications. There i found out that my requests are being timed-out. On further investigating i found out that i need to set System.Net.ServicePointManager.DefaultConnectionLimit = 100; to get it working. I tried that but i didn't work. I have also tried adding

<system.net>  
   <connectionManagement>  
     <add address = "*" maxconnection = "100" />  
   </connectionManagement>
</system.net>

to app.config , machine.config and web.config. Still i am never able to fire more than 5-6 requests and the remaining starts throwing time-out error. Any help will be highly appreciated.

Abdul
  • 77
  • 3
  • 9
  • What operating system is the server running on? – Ron Beyer May 12 '18 at 15:55
  • Are you using the `ThreadPool` class? [This](https://stackoverflow.com/questions/1361771/max-number-of-concurrent-httpwebrequests?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) shows a problem that also gets into trouble after 5 requests. – Bee May 12 '18 at 16:02
  • @Ron Its Windows 10 – Abdul May 12 '18 at 16:14
  • @David, I am using Task.Factory. StartNew() – Abdul May 12 '18 at 16:14
  • I'm skeptical that 100 concurrent connections on a single machine would *improve* the performance of anything. – Daniel Mann May 12 '18 at 16:45
  • Once i get past this restriction, i will try to find the sweet spot for the optimum number of connections. So far i am not being able to bypass the default limit – Abdul May 12 '18 at 16:48

0 Answers0