服务器抛出异常时,ASP.NET服务已完成事件从未触发 [英] ASP.NET Service Completed Event Never Fired When Server throws an Exception

查看:72
本文介绍了服务器抛出异常时,ASP.NET服务已完成事件从未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理我最初没有创建的现有应用程序的错误。 客户端是一个Win Forms应用程序,它使用ASP.NET服务与ASP.NET Web应用程序通信。 我目前正在转换一些同步调用
,这会将GUI线程长时间锁定到异步调用中。  ASP.NET服务的代理类已经具有异步方法。 在正常情况下,一切都按预期工作,但如果在服务器上的服务方法
中抛出异常,则异常会冒泡到我的客户端应用程序的AppDomain.CurrentDomain.UnhandledException处理程序,而不是立即返回执行完成事件我联系起来(这是我所期待的)。 有没有人知道为什么或者什么
会导致在服务器上发生异常时不会触发已完成的事件处理程序? 是否可以从服务中删除web.config设置? 我尝试创建一个简单的例子,但它工作得很好,所以我肯定知道有一些可疑的东西是
。 我甚至在我的示例项目中注释掉了整个web.config,它仍然有效,所以我认为它与此无关。 任何想法?

I'm working on a bug with an existing application that I did not originally create.  The client is a Win Forms app, and it communicates with an ASP.NET Web Application with an ASP.NET Service.  I'm currently converting some synchronous calls that lock up the GUI thread for too long into asynchronous calls.  The proxy class for the ASP.NET service already had the async methods.  Under normal circumstances, everything works as expected, but if an exception is thrown in the service method on the server, the exception bubbles up to my client app's AppDomain.CurrentDomain.UnhandledException handler, instead of returning execution immediately to the completed event I hooked up (which is what I was expecting).  Does anyone know why or what would cause the completed event handler not to be fired when an exception occurs on the server?  Could a web.config setting be missing from the service or something?  I tried creating a simple example, but it worked fine, so I definitely know there's something fishy going on.  I even commented out the entire web.config in my sample project, and it still worked, so I figure it has nothing to do with that.  Any ideas?

推荐答案

没有设置。

我刚试过这个,它适用于我。确保你正确地测试了它。

I just tried this, and it worked for me. Make sure you're testing this correctly.

已触发Completed事件,异常在e.Error中。

The Completed event fired, and the exception was in e.Error.


这篇关于服务器抛出异常时,ASP.NET服务已完成事件从未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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