我的WCF配置在我的開發人員機器上運行得很好。當我嘗試將它發佈到演示環境(另一臺服務器),它會給我以下錯誤:無法找到擴展
An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'log4net' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.
我的配置,這是在兩種情況下是相同的:
<system.serviceModel>
<services>
<service name="UI.WS.Services.MyService" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="wsHttpBinding"
contract="UI.WS.Services.IMyService"
bindingConfiguration="WsSecurityMode">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true" />
<!-- Extension -->
<log4net />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="WsSecurityMode">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<extensions>
<behaviorExtensions>
<!-- Extension -->
<add name="log4net" type="UI.WS.ErrorHandling.Log4NetBehaviorExtensionElement,UI,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
</system.serviceModel>
我已經檢查了這個hint,這不是問題(如果是這樣的話,我猜也不會在開發環境下運行)。
有什麼建議嗎?
我已經在少數情況下,元素的順序是非常重要的看到 - 你可以試試''部分移動的頂部''部分查看是否有幫助? –
carlosfigueira
我已經試過了,沒有幫助。 – sl3dg3