Solution 1: Increase limit globally
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
ServicePointManager.DefaultConnectionLimit = 100;
...
Solution 2: Icrease limit per server
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest webRequest = base.GetWebRequest(address);
HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
if (httpWebRequest != null)
{
httpWebRequest.ServicePoint.ConnectionLimit = 100;
}
...
No comments:
Post a Comment