我的 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>
我已经检查了这个提示,这不是问题(如果是的话,我猜它也不会在开发环境下运行)。
有什么建议么?