开发者

WCF Deployment issue

开发者 https://www.devze.com 2023-02-07 05:38 出处:网络
I have a issue in WCF that is driving me crazy. It is: The message with Action \'GetUserByUserNameAndPassword\' cannot be processed at thereceiver, due to a ContractFilter mismatch at the EndpointDi

I have a issue in WCF that is driving me crazy. It is:

The message with Action 'GetUserByUserNameAndPassword' 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).

The setup is as follows. I have one Web server running a client website in IIS 7 that is trying to communicate using WCF to another server which has SQL Server and a hosted WCF service in IIS 7.

Both these machines are on the same domain.

To try and strip it down to nothing I am trying to get this working with no security. The client config looks like this:

<bindings>
    <wsHttpBinding>
        <binding name="wsHttpBinding_Normal">
        <security mode="None"/>
        </binding>
    </wsHttpBinding&g开发者_运维技巧t;
</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>

Then on the server the config looks like this:

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

The method itself looks like this:

    [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);


You have to define the same contract on both ends (server and client). Even though they are both called IAuditLogger, they might have different signatures. Try putting only one IAuditLogger class in one separate assembly then reference it in both config files or make sure both IAuditLogger have the same methods.

You could have something like:

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

And

<services>
<service name="DS.Service.ServiceImplementation.AuditLogger">
    <endpoint address="http://192.168.1.10:3026/DS.Service/AuditLogger.svc"
    binding="wsHttpBinding" bindingConfiguration="NormalTrafficBinding"
    contract="AuditLogger.IAuditLogger">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>
</service>

0

精彩评论

暂无评论...
验证码 换一张
取 消