What does the WebClientAsyncR esult.Abort method actually do under the covers?
I have a windows service that is sending asynchronous requests to a web
service and then storing the IAsyncResult object in a hashtable with a
meaningful key. The web service will do some processing and then send an
email notification to a specified recipient and call a callback method so
that the IAsyncResult is removed from the hashtable. If the windows service
shuts down, I want to loop through each of my saved IAsyncResults, cast it to
a WebClientAsyncR esult, and call Abort. What I am finding, though, is that
when I call Abort from within the windows service, I get my web service
response right away (a la System.Net.WebE xception "The underlying connection
was closed...etc.), but the processing continues on the server to the
completion of the method. At times, even several minutes after I have called
the Abort method, I find that the server thread is not aborted and the emails
are still sending. What I want to happen is for the server thread to halt as
well as the client. Is there anything I can implement on the server side
that will check to see if the client async call was aborted midway through
the method?
Please advise.
Thanks,
TheManFromSql
I have a windows service that is sending asynchronous requests to a web
service and then storing the IAsyncResult object in a hashtable with a
meaningful key. The web service will do some processing and then send an
email notification to a specified recipient and call a callback method so
that the IAsyncResult is removed from the hashtable. If the windows service
shuts down, I want to loop through each of my saved IAsyncResults, cast it to
a WebClientAsyncR esult, and call Abort. What I am finding, though, is that
when I call Abort from within the windows service, I get my web service
response right away (a la System.Net.WebE xception "The underlying connection
was closed...etc.), but the processing continues on the server to the
completion of the method. At times, even several minutes after I have called
the Abort method, I find that the server thread is not aborted and the emails
are still sending. What I want to happen is for the server thread to halt as
well as the client. Is there anything I can implement on the server side
that will check to see if the client async call was aborted midway through
the method?
Please advise.
Thanks,
TheManFromSql
Comment