【发布时间】:2011-07-13 09:40:29
【问题描述】:
我开发了一个 wcf 服务。由于它也会被非.net 客户端调用,所以我使用了 basichttpbinding。有些方法需要模拟。这是通过用以下方式装饰网络方法来强制实现的:
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
在我们的测试服务器上部署服务后,调用服务时出现奇怪的错误:
无法加载文件或程序集“log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821”或其依赖项之一。未提供所需的模拟级别,或者提供的模拟级别无效。 (HRESULT 异常:0x80070542)
我收到此错误的方式与调用服务的方式无关。当我通过 wcfTestClient 调用它时我得到它,当我通过我编写的控制台应用程序调用它时我得到它。 (我将 Web 服务作为 Web 引用添加到此应用程序中,以模拟非 .net 客户端的行为。)
有什么想法吗?
PS:这是我的网络服务的 web.config:
<system.web>
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:15:00" openTimeout="00:15:00" sendTimeout="00:15:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<add value="CrmConnectorDiamondData.svc" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
【问题讨论】:
标签: wcf