我在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