如何在C#Web服務中將任何未捕獲的異常作爲SOAP錯誤返回?看起來,IIS正在'捕捉'異常並將其顯示在默認錯誤上。以下是san.web.config。.NET Web服務 - SOAP錯誤
<?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>