[英].NET Web Services - SOAP Faults
如何在我的C#Web服务中将任何未捕获的异常作为SOAP错误返回? 看来IIS正在“捕获”异常并在默认错误上显示它。 下面是上划线的web.config。
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<system.web>
<httpRuntime enableVersionHeader="false" />
<sessionState mode="Off" />
<compilation defaultLanguage="c#" debug="true" />
<authentication mode="None" />
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<webServices>
<protocols>
<remove name="HttpPost"/>
<remove name="HttpGet"/>
<remove name="Documentation"/>
<remove name="HttpSoap12" />
</protocols>
</webServices>
</system.web>
</configuration>
尝试从配置中删除customErrors部分。
事实证明,导致此问题的HttpModule的Application_EndRequest方法中存在代码问题。
事实证明HttpModule中的某些错误逻辑导致应用程序出错。 解决此问题后,应用程序将按预期运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.