Thread.Abort in WCF Service hosted on WAS restarting the Service
-
I have hosted a WCF service on WAS (on Windows Vista) and the protocol of the endpoint is netTcp. In the service I am starting a thread which takes a long time to run. It runs successfully. The problem is when ever Thread.Abort() is fired it restarts the service instead of aborting that thread only. In the first hit from the client it starts the thread and maintains the thread in the static dictionary and then on the second hit fires the request for cancellation from client to the service, then service method calls the Thread.Abort() for that particular thread I have tried the same using the Console host on the local machine and it's working fine and even aborting the specific thread.
-
I have hosted a WCF service on WAS (on Windows Vista) and the protocol of the endpoint is netTcp. In the service I am starting a thread which takes a long time to run. It runs successfully. The problem is when ever Thread.Abort() is fired it restarts the service instead of aborting that thread only. In the first hit from the client it starts the thread and maintains the thread in the static dictionary and then on the second hit fires the request for cancellation from client to the service, then service method calls the Thread.Abort() for that particular thread I have tried the same using the Console host on the local machine and it's working fine and even aborting the specific thread.
I don't know why you're experiencing the specific problem but you could look at using an alternative mechanism to Thread.Abort(). Have a read of this. It explains the problems around Thread.Abort and a neat alternative.
-
I don't know why you're experiencing the specific problem but you could look at using an alternative mechanism to Thread.Abort(). Have a read of this. It explains the problems around Thread.Abort and a neat alternative.
While using the Process class we need to mention the files, so the alternative provided in the article for the usage of Process calls doesn't seems to be feasible as the code is in the Service implementation class.