COM+:ApplicationException 而不是抛出异常

发布于 2024-09-24 11:41:48 字数 836 浏览 2 评论 0原文

我有一个 ASP.net Web 服务,它调用 COM+ 组件。 COM+ 组件中的一个类引发了我想要处理的异常。但ApplicationException是由webbservice捕获的,而不是真正的异常。

这是为什么?

编辑:异常详细信息

System.ApplicationException: Error in the application.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri)
   at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
   at mywebbservice.Batplanering.Behorighet(String sprak) in D:\utv\Bat\Main4\Src\mywebbservice\planering.asmx.vb:line 3542

I got a ASP.net webservice which calls a COM+ component. A class in the COM+ component throws an exception which I want to handle. But ApplicationException is caught by the webbservice instead of the real exception.

Why is that?

Edit: Exception details

System.ApplicationException: Error in the application.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri)
   at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
   at mywebbservice.Batplanering.Behorighet(String sprak) in D:\utv\Bat\Main4\Src\mywebbservice\planering.asmx.vb:line 3542

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野侃 2024-10-01 11:41:48

如果异常是从 ServicedComponent 的构造函数中引发的,则将引发 ApplicationException 而不是真正的异常。

我会将答案奖励给任何能告诉我原因的人。

ApplicationException is thrown instead of the real exception if the exception is thrown from within the constructor of the ServicedComponent.

I'll award the answer to anyone who can tell my why.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文