WCF部署问题

WCF部署问题,wcf,Wcf,我在WCF遇到了一个让我发疯的问题。它是: 由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理具有操作“GetUserByUserName和Password”的消息。这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无) 设置如下所示。我有一个Web服务器在IIS 7中运行一个客户端网站,该服务器试图使用WCF与另一个服务器进

我在WCF遇到了一个让我发疯的问题。它是:

由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理具有操作“GetUserByUserName和Password”的消息。这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)

设置如下所示。我有一个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);

您必须在两端(服务器和客户端)定义相同的契约。尽管它们都被称为IAuditLogger,但它们可能有不同的签名。尝试在一个单独的程序集中只放置一个IAuditLogger类,然后在两个配置文件中引用它,或者确保两个IAuditLogger具有相同的方法

你可以有这样的东西:

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



您必须在两端(服务器和客户端)定义相同的合同。尽管它们都被称为IAuditLogger,但它们可能有不同的签名。尝试在一个单独的程序集中只放置一个IAuditLogger类,然后在两个配置文件中引用它,或者确保两个IAuditLogger具有相同的方法

你可以有这样的东西:

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



不,这不是真的-如果您从Visual Studio执行标准的“添加服务引用”,客户端代理将生成到一个单独的命名空间中,契约将是相同的(就序列化方式而言),但它位于一个单独的客户端命名空间中!你说得对,这不是要求。很可能他使用的两个接口具有不同的签名,这将导致问题。解决方案是一样的,如果是这样的话,我可以修复文本。不,那不是真的-如果您从Visual Studio执行标准的“添加服务引用”,客户端代理将生成到一个单独的命名空间中,契约将是相同的(就序列化方式而言),但它位于一个单独的客户端命名空间中!你说得对,这不是要求。很可能他使用的两个接口具有不同的签名,这将导致问题。解决方案是相同的,如果是这种情况,我可以修复文本。有没有可能您更新了一个服务器端代码,却忘记了在另一台机器上更新/重新创建该服务器的客户端代理?有没有可能您更新了一个服务器端代码,却忘记了在另一台机器上更新/重新创建该服务器的客户端代理??