引发Web异常和unadvise()后,C#.net应用程序未退出. [英] C#.net application not exiting after throwing web exception and unadvise().

查看:111
本文介绍了引发Web异常和unadvise()后,C#.net应用程序未退出.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在开发一个C#Web客户端应用程序,该应用程序从Web服务器接收内容,并在成功进行身份验证后使用浏览器对象显示内容.理想情况下,当退出应用程序且需要取消订阅网络连接时,我们应调用IConnectionPoint的方法Unadvise(cookie).但是,当引发任何Web异常并且需要关闭应用程序时,该应用程序将没有响应并且无法退出.当我评论方法Unadvise(cookie)时,它运行良好,并且应用程序成功退出.

有没有一种方法可以解决该问题而无需注释Unadvise(cookie)?

Hi
I am developing a C# web client application which receives the content from a web server and displays it using a brower object after successful authentication. Ideally, when ever the application is exited and it needs to unsubscribe to network connection, we should call the method Unadvise(cookie) of IConnectionPoint. But when any web exception is thrown and the application needs to be closed, the application is not responding and it is not able to exit. When I comment the method Unadvise(cookie) it is working fine and the application is exiting succesfully.

Is there a way to solve the problem without commenting Unadvise(cookie)?

推荐答案

也许您可以将Unadvise(cookie)调用包装在try-catch中,并使用它来调试实际发生的情况.这样一来,您将可以更好地了解发生了什么.
Perhaps you could wrap the Unadvise(cookie) call in a try-catch and use that to debug what is really going on. That way you''ll have a much better idea of what is breaking.


这篇关于引发Web异常和unadvise()后,C#.net应用程序未退出.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆