«
»

ASP.NET, Programmeren, technologie

Operation has timed out at System.Net.HttpWebRequest GetResponse()

10.23.08 | Comment?

Niks zo leuk als problemen die zich alleen voordoen bij loadtesting of in productie omgevingen. Bovenstaande error doet zich concreet voor wanneer ik HttpWebRequest gebruik om vanuit mijn applicatie een andere webserver of service aan te roepen. De code werkt perfect in mijn development omgeving maar eens live loopt alles quasi onmiddellijk vast. Na enkele vergeefse pogingen laat ik de applicatie een karrevracht logs uitspuwen. Die leren mij het volgende : alles loopt zoals het hoort tot plots alle HttpWebRequest.GetResponse() calls timeouts gooien

The operation has timed out at System.Net.HttpWebRequest.GetResponse()

In de code zijn hiervoor geen oorzaken te vinden. In de config van de target server ook niet… Next step: google!

Hier vind ik meerdere artikels terug die gelijkaardige problemen toewijden aan de http 1.1 specificaties (RFC2616):

Clients that use persistent connections SHOULD limit the number of
   simultaneous connections that they maintain to a given server. A
   single-user client SHOULD NOT maintain more than 2 connections with
   any server or proxy. A proxy SHOULD use up to 2*N connections to
   another server or proxy, where N is the number of simultaneously
   active users. These guidelines are intended to improve HTTP response
   times and avoid congestion.

Dit blijkt meteen ook de default setting te zijn van .NET connectionManagement. Je kan het aanpassen door in de machine.config of de web.config de maxconnection setting van de connectionManagement section aan te passen.

<configuration>
   <system.net>
      <connectionManagement>
         <add name = "www.parivedasolutions.com" maxconnection = "4" />
         <add name = "*" maxconnection = "2" />
      </connectionManagement>
   </system.net>
</configuration>

Je kan het ook programmatorisch doen:

Uri con = new Uri ("http://www.parivedasolutions.com/");

// Use the FindServicePoint method to find an existing

// ServicePoint object or to create a new one.
ServicePoint servicePoint = ServicePointManager.FindServicePoint (con);
servicePoint.ConnectionLimit = 10;

Meer details op : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfconnectionmanagementelement.asp


have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:

:


«
»

My Index

0-10

A

Adwords campagne beheer

B

Baare.com
Baare TV
bakgerei voor kindjes

C

CE HTML
Community Server
Chicken coop builder
Chicken coops

D

E

F

Familie Anrijs
FrontierVille
FrontierVille guides review site

G

GarageTV
garagetv.be
Google Adwords - adverteren op zoekmachines
Google-approved Qualified Professional

H

Huur vakantiehuisjes

I

Internet reclame

J

JWI Consulting
JWI Blogt

K

Kabel televisie abonnementen
Kasteel van de Leeuwenridders
KMO website snelheidstest

L

M

N

O

P

P&O ferries
parket en laminaat leggen
Philips Net TV
Playmobilkasteel
Portfolio Development (.NET C# PHP)
Portfolio SEO (Search Engine Optimalisatie)
Provinciaal Voetbal
provinciaal voetbal Antwerpen
provinciaal voetbal Branbant
provinciaal voetbal Limburg
provinciaal voetbal Oost-Vlaanderen
provinciaal voetbal West-Vlaanderen

Q

R

S

SEO analyse
SEO (Search Engine Optimization)
Snelheids voor kmo websites

T

www.telekoop.be (te koop, nieuw & tweedehands)
Top vakanties
tv gids
advies bij tv kopen

U

V

Verjaardagsfeestjes voor kindjes
Voetbal uitslagen
online voetbalschoenen kopen

W

google webmaster tools

X

Y

Z

Zoekmachine optimalisatie