1
我有這個WCF異常。我檢查this SO問題,但我仍然不知道什麼是錯的WCF- ContractFilter不匹配在EndpointDispatcher
實際的異常MESSAGE-
The message with Action 'http://tempuri.org/ITramsApplicationService/GetAllApplications' 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).
我試圖修改客戶端和WCF服務都在我的綁定配置,但這並沒有幫助
配置在WCF服務 -
<basicHttpBinding>
<binding name="FileServiceConfiguration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="1638400" maxArrayLength="2097152" maxBytesPerRead="409600" maxNameTableCharCount="1638400" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<service behaviorConfiguration="Default" name="Tavisca.TramsFileService.ServiceImplementation.TramsApplicationServiceImpl">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="FileServiceConfiguration" contract="Tavisca.TramsFileService.ServiceContracts.ITramsApplicationService" />
</service>
配置客戶端/消費者爲
<endpoint address="http://localhost:20020/TramsFileService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITramsApplicationService"
contract="TramsFileServices.ITramsApplicationService" name="BasicHttpBinding_ITramsApplicationService" />
<binding name="BasicHttpBinding_ITramsApplicationService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="1638400" maxArrayLength="2097152" maxBytesPerRead="409600" maxNameTableCharCount="1638400" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
很可能它不是綁定,而是兩個合約中方法/數據成員的定義不匹配。嘗試更新服務參考。 – BartoszKP