在服务‘MyService’实现的约定列表中找不到约定名称'IMyService‘..-> System.InvalidOperationException:在服务'MyService‘实现的约定列表中找不到约定名称'IMyService’。
我都快疯了。我有一个可以在我的开发机器上工作的WCF web服务,但是当我将它复制到我正在用于测试的虚拟机时,我得到的错误似乎表明我没有实现该接口,但这没有意义,因为该服务在我的windows xp IIS上工作。虚拟机使用Windows Server 2003 IIS。有什么想法吗?
这里需要注意的一件事是,我在虚拟机上遇到了这个错误,即使我只是试图作为客户端在web浏览器中访问服务。
注意:我使用的是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>
发布于 2010-04-01 23:41:49
在我的案子里[ServiceContract]
失踪了。
发布于 2010-03-23 12:21:34
@Garry (我知道,有点晚了)
如果ServiceContract属性定义了ConfigurationName,则这应该是端点中的值,而不是完全限定的名称。正如操作员所描述的那样,我现在遇到了这个问题,这就是我的解决方案。希望这篇文章能帮助其他偶然发现这篇文章的人。
发布于 2011-02-02 08:57:58
这是一个稍微不常见的解决方案,适用于我的情况,但也有相同的错误:
可以使用以下属性覆盖协定名称空间:
[System.ServiceModel.ServiceContractAttribute([...], ConfigurationName = "IServiceSoap")]
public interface ISomeOtherServiceName
这将需要:
<endpoint address="" binding="basicHttpBinding" contract="IServiceSoap" />
而不是通常的(namespace).ISomeOtherServiceName.
这可能是代码生成的结果,在我的例子中是WSCFBlue
https://stackoverflow.com/questions/691746
复制相似问题