我在WCF中遇到了一个令我疯狂的问题。它是:WCF部署问题
由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理具有Action'GetUserByUserNameAndPassword'的消息。这可能是因为合同不匹配(发件人和收件人之间的操作不匹配)或发件人和收件人之间的绑定/安全性不匹配。检查发送方和接收方是否有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无)。
设置如下。我有一台Web服务器在IIS 7中运行客户端网站,该客户端尝试使用WCF与另一台服务器进行通信,该服务器在IIS 7中具有SQL Server和托管WCF服务。
这两台机器位于同一个域中。
尝试将其剥离为无,我试图让这个工作没有安全。客户端的配置是这样的:
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_Normal">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.10:3026/DS.Service/AuditLogger.svc"
binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Normal"
contract="AuditLogger.IAuditLogger" name="wsHttpBinding_IAuditLogger">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
然后在服务器上的配置是这样的:
<bindings>
<wsHttpBinding>
<binding name="NormalTrafficBinding">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="DS.Service.ServiceImplementation.AuditLogger">
<endpoint address="http://192.168.1.10:3026/DS.Service/AuditLogger.svc"
binding="wsHttpBinding" bindingConfiguration="NormalTrafficBinding"
contract="DS.Service.ServiceContracts.IAuditLogger">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
<services>
本身看起来像这样的方法:
[OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "GetUserByUserNameAndPassword")]
[FaultContract(typeof(DS.Service.FaultContracts.DSOfficeFault))]
System.Data.DataSet GetUserByUserNameAndPassword(string userName, string password);
你更新一个服务器端的代码,忘了任何机会,以更新/重新创建另一台机器上该服务器的客户端代理? – 2011-01-27 15:14:25