Connecting Tech Pros Worldwide Forums | Help | Site Map

WebClientAsyncResult: client-side only?

The Man From SQL
Guest
 
Posts: n/a
#1: Jun 20 '06
What does the WebClientAsyncResult.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 WebClientAsyncResult, 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.WebException "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

Patrice
Guest
 
Posts: n/a
#2: Jun 20 '06

re: WebClientAsyncResult: client-side only?


You could try Response.IsClientConnected. Please let use know if it works

(never tried this, it may expose a result that is found during the lest
response.write, it could be also possible that buffering needs to be turned
off).

--
Patrice

"The Man From SQL" <themanfromsql@community.nospam> a écrit dans le message
de news: 1E918B18-CBDB-40DC-AED1-EC9FD4DB71CA@microsoft.com...[color=blue]
> What does the WebClientAsyncResult.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 WebClientAsyncResult, 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.WebException "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[/color]


The Man From SQL
Guest
 
Posts: n/a
#3: Jun 20 '06

re: WebClientAsyncResult: client-side only?


Patrice,

That worked like a charm. If you ever get to Cedar Rapids, Iowa, I owe you
homemade ice cream.

Thanks,

TheManFromSQL


"Patrice" wrote:
[color=blue]
> You could try Response.IsClientConnected. Please let use know if it works
>
> (never tried this, it may expose a result that is found during the lest
> response.write, it could be also possible that buffering needs to be turned
> off).
>
> --
> Patrice
>
> "The Man From SQL" <themanfromsql@community.nospam> a écrit dans le message
> de news: 1E918B18-CBDB-40DC-AED1-EC9FD4DB71CA@microsoft.com...[color=green]
> > What does the WebClientAsyncResult.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 WebClientAsyncResult, 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.WebException "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[/color]
>
>
>[/color]
Closed Thread