WebClientAsyncResult: client-side only?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Man From SQL

    #1

    WebClientAsyncResult: client-side only?

    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
  • Patrice

    #2
    Re: WebClientAsyncR esult: client-side only?

    You could try Response.IsClie ntConnected. 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.nospa m> a écrit dans le message
    de news: 1E918B18-CBDB-40DC-AED1-EC9FD4DB71CA@mi crosoft.com...[color=blue]
    > 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[/color]


    Comment

    • The Man From SQL

      #3
      Re: WebClientAsyncR esult: 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.IsClie ntConnected. 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.nospa m> a écrit dans le message
      > de news: 1E918B18-CBDB-40DC-AED1-EC9FD4DB71CA@mi crosoft.com...[color=green]
      > > 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[/color]
      >
      >
      >[/color]

      Comment

      Working...