我遵循本文中提到的步驟http://dotnetslackers.com/articles/aspnet/Getting-ELMAH-to-work-with-WCF-services.aspx配置WCF服務來設置錯誤日誌記錄由ELMAH。它與wsHttpBinding一起使用Visual Studio網絡服務器,但是當我在IIS(5/6)中託管它並將綁定更改爲basicHttpBinding時,它不會記錄錯誤。我試圖將錯誤信號代碼更改爲「Elmah.ErrorLog.GetDefault(null).Log(new Error(ex));
」,如鏈接ELMAH - Exception Logging without having HttpContext所述,但這也沒有幫助。不知道我還需要做什麼。請幫忙。這裏是WCF服務的配置(我嘗試評論和取消註釋aspnetcompatibility,但沒有工作)。如果有一個basicHttpBinding的工作示例,這將是非常有用的。提前致謝。錯誤日誌記錄由ELMAH不工作在IIS中使用basicHttpBinding承載的WCF服務
<system.serviceModel>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />-->
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ElmahWCF.Service1Behavior" name="ElmahWCF.Service1">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="BasicHttpEndpointBinding"
name="BasicHttpEndpoint" contract="ElmahWCF.IService1">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ElmahWCF.Service1Behavior">
<!--To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment-->
<serviceMetadata httpGetEnabled="true"/>
<!--To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>