开发者

How do you end an Application from a Web Method within a Web Service?

开发者 https://www.devze.com 2022-12-09 22:56 出处:网络
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

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?


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).


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


I believe I can "stop" the web service by clearing the session variables. Is this true? Using code:

        Session.Contents.Abandon();
0

精彩评论

暂无评论...
验证码 换一张
取 消