WCF错误:EndpointDispatcher上的ContractFilter不匹配

时间:2016-05-13 04:54:01

标签: web-services wcf wsdl

我是WCF的新手并且已经破坏了我的大脑......我确信我错过了一些东西。我已经搜索了一千零一个论坛,但迄今为止没有任何建议。

错误如下:

由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理带有操作“http://somedomain/someinterface/someservice”的消息。这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配。检查发件人和收件人是否具有相同的合同和相同的约束(包括安全要求,例如邮件,传输,无)。

测试客户端应用程序在连接到示例服务时没有工作(除了WSDL之外没有其他文档),但是当我将相同的测试客户端应用程序连接到我自己从该示例构建的服务时,会收到错误。

我比较了WSDL定义,而不是域名,它完全相同。从日志中我现在注意到以下内容。首先记录上面的错误,但是还记录了第二个(内部异常?),但是同样的错误,但行动URL显示为“http://somedomain/someinterface/somehiddenservice”。

我需要一些指针(不一定是解决方案):

  1. 我需要在这里查看什么才能找到问题?
  2. 这个“somehiddenservice”不应该出现在WSDL上吗?
  3. 任何指出我正确方向的建议都会很棒。

    这是我的webservice的配置部分:

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_ISomeInterface" />
            </basicHttpBinding>
            <basicHttpsBinding>
                <binding name="BasicHttpsBinding_ISomeInterface"/>
            </basicHttpsBinding>
        </bindings>
        <services>
            <service name="MyNS.SomeService" behaviorConfiguration="MyNS.Service1Behavior">
                <endpoint address="http://somedomain/SomeService.svc"  binding="basicHttpBinding"  contract="MyNS.ISomeInterface" />
                <endpoint address="https://somedomain/SomeService.svc"  binding="basicHttpsBinding"  contract="MyNS.ISomeInterface" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
        </services>
    
        <behaviors>
            <serviceBehaviors>
                <behavior name="MyNS.Service1Behavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    
        <protocolMapping>
            <add binding="basicHttpBinding" scheme="http" />
            <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
    </system.serviceModel>
    

    我稍后回家时会通过客户端配置发送,但同时schemaLocation节点的顺序会有所不同吗?

    <xsd:schema targetNamespace="http://somedomain/Imports">
    <xsd:import schemaLocation="http://somedomain/someservice.svc?xsd=xsd1" namespace="http://somedomain/"/>
    <xsd:import schemaLocation="http://somedomain/someservice.svc?xsd=xsd0" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
    <xsd:import schemaLocation="http://somedomain/someservice.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/System"/>
    </xsd:schema>
    

    你如何操纵xsd1,xsd0等的顺序?

0 个答案:

没有答案