WebClient Freezes for Ten Seconds on First Connect
am 09.04.2008 18:24:56 von Jules WinfieldI've build a client-server application in which the client communicates with
the server by making calls to WebClient.UploadValuesAsync().
In a given client session, hundreds of calls will be made and generally
speaking I'm pleased with the performance. It only takes a few milliseconds
from the time UploadValuesAsync() is called to the time the server receives
the request and begins processing it. The problem is that the FIRST call of
the session takes around ten seconds to get from client to server.
During this ten second period, the UploadValuesAsync() call blocks.
Repeatedly running "netstat -n" at the command line indicates that the
connection is not established during this period. Then, after ten sesconds,
netstat shows the new connection, UploadValuesAsync() unblocks, and all is
well.
I can't for the life of me figure out what is causing this problem. The ten
second hang time wouldn't really bother me in production mode, but it makes
development a real pain, because each time I make a change to the code and
want to test it, I have to deal with it. Any ideas?
Jules