I use .NET framework 2.0, and I want to cancel async. web service.
I tried to use "CancelAsync (object userstate)", but the web service is
still running.
This is my example code.
----------------------------------------------
MyService ws = new MyService();
ws.function1Completed += new
function1CompletedEnvetHandler(ws_function1Completed);
object userState;
ws.function1(userState);
Thread.Sleep(10000);
ws.CancelAsync (userState);
-------------------------------------
Thank you
Thanapol R.
Josh Twist - 09 Mar 2006 10:42 GMT
Because of the stateless nature of HTTP - this is very difficult to
achieve. The CancelAsync method will only cancel the local thread that
is making the request. The web service itself has no idea this has
happened.
Josh
http://www.thejoyofcode.com/
Martin Kulov - 12 Mar 2006 23:57 GMT
>I use .NET framework 2.0, and I want to cancel async. web service.
> I tried to use "CancelAsync (object userstate)", but the web service is
> still running.
Hi Thanapol,
initialize your web service call with an instance of Monitor class and check
its state during your asynchronous call. When it is signaled, just return
from the call. This is the most convenient way IMHO.
Regards,

Signature
Martin Kulov
http://www.codeattest.com/blogs/martin
MCT
MCSD.NET Early Achiever