Web 服务中的默认异常处理

发布于 2024-09-10 12:47:00 字数 335 浏览 1 评论 0原文

在我的应用程序中,我正在调用网络服务。

try
{
   theWebService.Method(parameter);
}
catch (Exception e)
{
   //This catches and logs a SoapException
}

当我这样做时,SoapException 被捕获,并且我只得到关于该问题的一行句子。我假设 SoapException 只是中继 Web 服务中发生的实际异常的信息(如果我对此有误,请纠正我)。 Web 服务是否在某处记录了完整的异常?如果是的话,记录在哪里?请注意,除了默认的日志记录之外,没有向该服务添加任何其他日志记录。

In my application I am calling a web service.

try
{
   theWebService.Method(parameter);
}
catch (Exception e)
{
   //This catches and logs a SoapException
}

When I do this the a SoapException is caught and I'm only given a one line sentence on the issue. I'm assuming the SoapException is just relaying information from the actual exception that occurred in the web service (please correct me if I'm wrong about this). Does the web service log the full exception somewhere and if so where? Note that no additional logging has been added to the service besides what comes by default.

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

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

发布评论

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

评论(1

白色秋天 2024-09-17 12:47:00

我假设您仍在使用旧版 ASMX Web 服务,而不是 WCF。

SoapException 不仅仅中继来自服务的异常。它还可用于将 SOAP 错误消息返回给调用者。

默认情况下,ASMX Web 服务中未处理的异常将调用 ASP.NET 运行状况监控。默认情况下,这将在事件日志中输入一个事件,其中包含有关异常的详细信息。

I'll assume you're still using legacy ASMX web services, and not WCF.

SoapException does not just relay the exception from the service. It can also be used to return a SOAP Fault message back to the caller.

By default, an unhandled exception in an ASMX web service will invoke ASP.NET Health Monitoring. By default, this will enter an event in the event log with details about the exception.

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