【发布时间】:2010-10-16 01:25:12
【问题描述】:
在服务“MyService”实施的合同列表中找不到合同名称“IMyService”.. ---> System.InvalidOperationException:在合同列表中找不到合同名称“IMyService”由服务“MyService”实现。
这快把我逼疯了。我有一个可以在我的开发机器上运行的 WCF Web 服务,但是当我将它复制到我用于测试的虚拟机时,我收到似乎表明我没有实现接口的错误,但它没有感觉,因为该服务确实可以在我的 windows xp IIS 上运行。虚拟机使用 Windows Server 2003 IIS。有什么想法吗?
这里需要注意的一点是,即使只是尝试在 Web 浏览器中作为客户端访问该服务,我也会在我的 VM 上收到此错误。
注意:我使用的是 principalPermissionMode="UseWindowsGroups",但这在我的本地计算机上不是问题。我只是将自己添加到适当的 Windows 组中。但是我的虚拟机没有运气。
配置:
<configuration>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="false" maxSizeOfMessageToLog="2147483647" />
</diagnostics>
<services>
<service behaviorConfiguration="MyServiceBehaviors" name="MyService">
<endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
name="MyService" bindingName="basicHttpBinding" bindingNamespace="http://my.test.com"
contract="IMyService">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="WindowsClientOverTcp" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="wsHttpBinding" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceAuthorization principalPermissionMode="UseWindowsGroups"
impersonateCallerForAllOperations="false" />
<serviceCredentials />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
【问题讨论】:
-
带有接口的程序集是否对应用程序可见?另外,您是否在配置文件中将命名空间指定为接口名称的一部分?
标签: .net wcf exception-handling