【发布时间】:2011-06-13 15:45:34
【问题描述】:
我有一个 wcf restful 服务启动并运行。如果我使用 WebServiceHost 启动 Web 服务,我可以毫无问题地发出 Get/Post。我尝试将 wcf 服务移至本地机器上的 IIS 7.5,但似乎无法启动。
当我尝试从 wcf 服务调用任何内容时,我不断收到以下错误:(http://wp9dbytr1k1:8081/service.svc/AnythingHereForGETorPUT)。我在虚拟目录/设备中尝试过,我遇到了同样的问题。
The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
如果我直接调用 svc 文件 (http://wp9dbytr1k1:8081/service.svc),它会很高兴并告诉我
“您已经创建了一项服务。 要测试此服务,您需要创建一个客户端并使用它来调用该服务。您可以使用命令行中的 svcutil.exe 工具执行此操作,语法如下: svcutil.exe http://wp9dbytr1k1:8081/FUU/service.svc?wsdl"
来自 Trace 查看器的 strack trace 没有帮助:抱歉必须添加链接,还不允许发布图像。 (ImageLink)
这是我的 web.config
<system.serviceModel>
<bindings>
<mexHttpsBinding>
<binding name="NewBinding0" />
</mexHttpsBinding>
<webHttpBinding>
<binding name="WebBinding">
<readerQuotas maxDepth="524288" maxStringContentLength="524288"
maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="StoredProcBehaviors" name="StoredProcService.DataRetreivalService">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="WebBinding"
contract="StoredProcService.IDataRetreivalService">
<identity>
<dns value="locahost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="StoredProcService.IDataRetreivalService" />
<host>
<baseAddresses>
<add baseAddress="http://WP9DBYTR1K1:8081/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="StoredProcBehaviors">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
由于显而易见的原因,这感觉就像 IIS 设置,因为它与 WebServiceHost 一起使用。我在 Google 上搜索了有关如何设置的错误/教程,一切对我来说似乎都很好。
有什么建议吗?
谢谢
【问题讨论】: