开发者

How do I call a webservice in the Application_Exit event?

How do I call a webservice in the Application_Exit event?

private void Application_Exit(object sender, EventArgs e)
{
  TestWSSoapClient.ReleaseUserCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(TestWSSoapClient_ReleaseUserCompleted);
  TestWSSoapClient.ReleaseUserAsync(UserToken);
}

The method below is no longer executed.

void TestWSSoapClien开发者_如何转开发t_ReleaseUserCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{

}

Thank you in advance.


You can't call any web services when exiting by design, however this article might help you with an Javascript alternative.


Do you really need to get the response? You won't be able to get it as all threads will be closed at the end of the Application_Exit function. But if it doesn't matter, you can configure your "ReleaseUser" operation as OneWay.

As I didn't test it, it is only a supposition, but I think it should work (and if it doesn't, well, I will learn something)

Otherwise, as said before, javascript is the only way to go, but it won't work Out of Browser.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜