簡體   English   中英

.NET Web服務-SOAP錯誤

[英].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>

我相信此鏈接描述了您要查找的內容:

http://aspalliance.com/727_CodeSnip_Handling_SOAP_Exceptions_in_Web_Services

嘗試從配置中刪除customErrors部分。

事實證明,導致此問題的HttpModule的Application_EndRequest方法中存在代碼問題。

事實證明HttpModule中的某些錯誤邏輯導致應用程序出錯。 解決此問題后,應用程序將按預期運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM