gpt4 book ai didi

.net - 找不到WCF合约名称 'IMyService'?

转载 作者:行者123 更新时间:2023-12-03 06:03:31 25 4
gpt4 key购买 nike

The contract name 'IMyService' could not be found in the list of contracts implemented by the service 'MyService'.. ---> System.InvalidOperationException: The contract name 'IMyService' could not be found in the list of contracts implemented by the service 'MyService'.

这让我发疯。我有一个在我的开发计算机上运行的 WCF Web 服务,但是当我将其复制到我用于测试的虚拟机时,我收到错误,该错误似乎表明我没有实现该接口(interface),但它并没有使有道理,因为该服务确实可以在我的 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>

最佳答案

[ServiceContract] 在我的案例中缺失。

关于.net - 找不到WCF合约名称 'IMyService'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/691746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com