HttpWebRequest and maximum http connection

  • Thread starter Thread starter faser
  • Start date Start date
F

faser

In a windows form I execute a lot of HttpWebRequest. Each request run
in his own thread and every requests have the same target server.
Looking at netstat and in the web server logs it seems to me that only
2 connection are opened even if I have 100 threads.
Do you know how can I modify this limit in my application?
Thanks.
 
Hi,
In a windows form I execute a lot of HttpWebRequest. Each request run
in his own thread and every requests have the same target server.
Looking at netstat and in the web server logs it seems to me that only
2 connection are opened even if I have 100 threads.
Do you know how can I modify this limit in my application?
Thanks.

The two-connections limits is set by HTTP according to RFC2616. On
Windows clients, you can increase this limit using the following
registry settings:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings
or to (all users):
HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\Internet
Settings
if you are the main or only user on this computer.

In the right hand pane you need to create these 2 DWORD [REG_DWORD]
Values because they are not present by default [don't type the quotes
though :)]:

· "MaxConnectionsPer1_0Server": defines the number of
simultaneous requests to a single HTTP 1.0 server. Double-click on it
and type any integer value between 8 and 32 (I use 16) in the Decimal
box. Default is 4.

· "MaxConnectionsPerServer": defines the number of simultaneous
requests to a single HTTP 1.1 server. Double-click on it and type any
integer value between 4 and 24 (I use 8) in the Decimal box. Default is 2.

HTH,
Laurent
 
Laurent said:
The two-connections limits is set by HTTP according to RFC2616. On
Windows clients, you can increase this limit using the following
registry settings:

Ok, now I understand. Thank you.
 
Thus wrote Laurent,
Hi,

The two-connections limits is set by HTTP according to RFC2616. On
Windows clients, you can increase this limit using the following
registry settings:
[...]

You don't have to hack the registry to use more parallel connections: See
ServicePointManager.DefaultPersistentConnectionLimit and ServicePointManager.DefaultConnectionLimit.

Cheers,
 
Hi Joerg,

Joerg said:
Thus wrote Laurent,

*music playing in the background......*
You don't have to hack the registry to use more parallel connections:
See ServicePointManager.DefaultPersistentConnectionLimit and
ServicePointManager.DefaultConnectionLimit.

Cheers,

I was not aware of that, having spent most of my .NET time doing ASP.NET
applications, where JavaScript doesn't this kind of ability...

Question: Do you happen to know if that's also possible from within a
XBAP application running in Internet zone? I guess I'll have to test that.

Greetings and thanks,
Laurent
 
Thus wrote Laurent,
Hi Joerg,


*music playing in the background......*

I was not aware of that, having spent most of my .NET time doing
ASP.NET applications, where JavaScript doesn't this kind of ability...

Question: Do you happen to know if that's also possible from within a
XBAP application running in Internet zone? I guess I'll have to test
that.

Looking at my CAS configuration the answer is yes, but you should test it
anyway ;-)

Cheers,
 
Hi Joerg,

Joerg said:
Thus wrote Laurent,


Looking at my CAS configuration the answer is yes, but you should test
it anyway ;-)

Cheers,

Unfortunately, looking at the documentation, I think the answer is no...
but once again, I really need to test it. I'll do ASAP and report.

..NET Framework Security:
WebPermission for unrestricted web permissions. Associated Enumeration:
Unrestricted

Greetings,
Laurent
 
Thus wrote Laurent,
Hi Joerg,


Unfortunately, looking at the documentation, I think the answer is
no... but once again, I really need to test it. I'll do ASAP and
report.

Karsten Januszewski is working on a pretty extensive blog entry that covers
web services and XBAPs. Keep an eye on http://blogs.msdn.com/karstenj/.

Cheers,
 
Back
Top