I'm trying to create a method within a web service that will terminate the application when called. The purpose of this is to end a game being played with a Windows form. Does anyone have any ideas? Thank you.
+1
A:
Generally your web method is in a completely different process, hence you cannot directly terminate the process [of the caller]. You should communicate the need to terminate back to the caller either via an indicator in the response or via an Exception (as part of a FaultContract).
Ruben Bartelink
2009-11-03 14:51:36
A:
If the WinForm is running on the server, where the web service is, you can stop it using Process.Kill method http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx
Boris Modylevsky
2009-11-03 15:15:35
Only if you're running as admin, which requires a lot of configuration. Dont do that!
Ruben Bartelink
2009-11-04 08:40:51
A:
I believe I can "stop" the web service by clearing the session variables. Is this true? Using code:
Session.Contents.Abandon();
Louise
2009-11-03 18:53:58
No, all that will do is flush any of the current user's credentials involved with connecting to the web service in question. It will not stop the service (others could be connected and have different session data) nor will it kill any processes you had attached.
Dillie-O
2009-11-03 18:56:46