首页 > 解决方案 > WCF 自托管 WebService AddresFilter 不匹配

问题描述

我将工作中的自托管 WebService 迁移到 HTTPS。当我尝试调用方法时出现此错误:

  <s:Fault>
     <s:Code>
        <s:Value>s:Sender</s:Value>
        <s:Subcode>
           <s:Value>a:DestinationUnreachable</s:Value>
        </s:Subcode>
     </s:Code>
     <s:Reason>
        <s:Text xml:lang="it-IT">The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.  Check that the sender and receiver's EndpointAddresses agree.</s:Text>
     </s:Reason>
  </s:Fault>

这是我的 app.Config:

<system.serviceModel>
<services>
  <service name="XWebServiceLib.XWebService"  behaviorConfiguration="XWebServiceBehave">
    <host>
      <baseAddresses>
        <add baseAddress="https://xxx.yyy.it/XWebService"/> 
      </baseAddresses>
    </host>
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MyBinding" contract="XWebServiceLib.IXWebService"/>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="XWebServiceBehave">
      <serviceMetadata httpsGetEnabled="true"  httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsHttpBinding>
    <binding name="MyBinding">
      <security mode="Transport">
    <transport clientCredentialType="None"/>
      </security>
    </binding>                 
  </wsHttpBinding>
</bindings>

在迁移到 HTTPS 之前,一切正常……有什么想法吗?

标签: c#visual-studiowcfsoapuiself-hosting

解决方案


在我这边,它运作良好。除了信任服务器端的证书之外,我们还需要添加一个默认wsa:to操作。 即,SOAP 消息中需要以下 SOAP 标头。 之后,它可以正常工作。如果问题仍然存在,请随时告诉我。
在此处输入图像描述

在此处输入图像描述


推荐阅读