c# - How to free connection after HttpWebRequest Async Abort() -
here's understand using httpwebrequest make request asyncronously:
the essential structure making asynchronous web request call begingetresponse() , start timer @ same time. if response doesn't timeout, begingetresponse() call callback method call endgetresponse() , read response. if response timeout, different callback method timer gets called , webrequest.abort() invoked.
this structure hinges on fact abort() , endgetresponse() exclusive. calling abort() after endgetresponse() has no effect , calling endgetresponse() after abort() causes endgetresponse() throw exception can caught , handled want handle timeouts.
my problem when need make several hundred requests per second several services , 1 service starts becoming very, latent. timeout callback might called after 500ms , calls abort() , program continues happily. because service still hasn't returned 10 seconds later, first thread started begingetresponse() still waiting , network connection resource unavailable use future requests.
is there way have timeout free resources of thread supposedly timing out? if not, there web.config value can set timeout request on different layer of network application?
free resources
- implies me thread should have destructor/finalizer releases unmanaged resources ( what unmanaged resources? ) has.
Comments
Post a Comment