我正在使用WCF服務,並希望使用企業庫ExceptionHandling塊將錯誤消息發送回客戶端,但我遇到了問題。我在網上發現了很少這個錯誤。使用企業庫時WCF服務中的「無法識別的配置節exceptionHandling」
我在web.config中添加了exceptionHandling塊,並且還引用了configSections中的exceptionHandling,但仍然出現錯誤。
我也在我的項目中引用了ExceptionHandling.WCF dll。
我不應該做任何事情,但是當我發佈並在瀏覽器中啓動服務時,它仍會引發錯誤。
任何想法?這可能很簡單,但我找不到問題。下面是我在web.config中的相關章節:
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<exceptionHandling>
<exceptionPolicies>
<add name="WCF Exception Shielding">
<exceptionTypes>
<add type="System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="ThrowNewException" name="ArgumentNullException">
<exceptionHandlers>
<add
type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.FaultContractExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF"
name="DefaultFaultContract Handler"
faultContractType="Bursteg.Samples.WCFIntegration.ServiceContracts.ServiceFault, Bursteg.Samples.WCFIntegration.ServiceContracts">
<mappings>
<add name="Id" source="{Guid}"/>
<add name="MessageText" source="{Message}"/>
</mappings>
</add>
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
我有一個結束標記爲。只是沒有把它放進去。對不起。 –
2010-05-03 15:58:54