none
WCF service and Netscaler Load Balancer RRS feed

  • Question

  • Hello,

    I have a Citrix Netscaler in front of a couple of servers hosting my WCF service. If I point my client directly to one of the backend severs the service works great.  But, when I change the IP to point to the Citrix Netscaler I get the following error:

    The message with Action http://172.xx.xxx.xxx:8801/MyService/Bsp2301/IBsp2301/Transmit cannot be processed at the receiver due to a Contract Filter mismatch at the Endpoint Dispatcher.  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).

    Here is the binding for my WCF service residing on my production server.

      <system.serviceModel>
        <bindings>
          <netTcpBinding>
            <binding
              transferMode="Streamed"
                  openTimeout="00:02:00"
                  closeTimeout="00:02:00"
                  receiveTimeout="00:02:00"
                  sendTimeout="00:02:00"
                  maxReceivedMessageSize="2147483647"
                  maxBufferSize="2147483647"
                  maxBufferPoolSize="2147483647">
              <security mode="None"></security>
            </binding>
          </netTcpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="ServiceBehavior" name="MyService.Bsp2301">
            <endpoint address="" binding="netTcpBinding" bindingConfiguration="" bindingNamespace="http://172.xx.xxx.xxx:8801/MyService/Bsp2301/"
              contract="IBsp2301">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" bindingNamespace="http://172.xx.xxx.xxx:8801/MyService/Bsp2301/"
                      contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://172.xx.xxx.xxx:8801/MyService/Bsp2301/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ServiceBehavior">
              <serviceMetadata httpGetEnabled="false" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    So, once my WCF service was running I discovered it in VS2012 using the following endpoint:  net.tcp://172.xx.xxx.xxx:8801/MyService/Bsp2301/mex

    I then run my test client pointing directly to the server with the WCF service and it works.

    Next I took the existing proxies which I discovered by pointing directly to the endpoint above and modified the IP throughout all of it to be the Netscaler IP and I renamed it BspNetScaler.  When I run it here I get the Contract Filter mismatch error.

    My test client code is as follows:

    NetTcpBinding mybinding = new NetTcpBinding();
                mybinding.Security.Mode = SecurityMode.None;
                mybinding.TransferMode = TransferMode.Streamed;
                mybinding.MaxBufferPoolSize = int.MaxValue;
                mybinding.MaxBufferSize = int.MaxValue;
                mybinding.MaxReceivedMessageSize = int.MaxValue;
                mybinding.SendTimeout = new TimeSpan(0, 0, 120);
                mybinding.CloseTimeout = new TimeSpan(0, 0, 120);
                mybinding.OpenTimeout = new TimeSpan(0, 0, 120);
                mybinding.ReceiveTimeout = new TimeSpan(0, 0, 120);
                
                string uri = "net.tcp://172.xx.xxx.xxx:8801/MyService/Bsp2301";

                EndpointAddress myendpoint = new EndpointAddress(uri);
                
                BspNetScaler.Bsp2301Client client = new BspNetScaler.Bsp2301Client(mybinding, myendpoint);
                string cmd = "Hello World";
                
                string result = client.Transmit(cmd);
                
                MessageBox.Show(result3);

    I have told our server tech that my security mode is None and my Transfer Mode is streamed.  He tells me that configuring a Citrix Netscaler is much different from configuring my WCF service.  I don't have much experience with a Citrix Netscaler so I'm not sure what to tell him.  We did have a Citrix rep on the line but were unable to resolve the issue.

    If anyone is able to add anything to help me resolve the issue I'd sure appreciate it.

    Thanks!!!!



    • Edited by Hiline1961 Monday, December 16, 2013 10:28 PM
    Monday, December 16, 2013 10:18 PM

Answers

  • Hi,

    A "ContractFilter mismatch at the EndpointDispatcher" means the receiver could not process the message because it did not match any of the contracts the receiver has configured for the endpoint which received the message.

    This can be because:

    • You have different contracts between client and sender.
    • You're using a different binding between client and sender.
    • The message security settings are not consistent between client and sender.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 17, 2013 3:18 AM
    Moderator

All replies

  • Hi,

    A "ContractFilter mismatch at the EndpointDispatcher" means the receiver could not process the message because it did not match any of the contracts the receiver has configured for the endpoint which received the message.

    This can be because:

    • You have different contracts between client and sender.
    • You're using a different binding between client and sender.
    • The message security settings are not consistent between client and sender.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 17, 2013 3:18 AM
    Moderator
  • Thanks Amy.  I had previously found that and it's true.

    In my case, I had my interface as follows:

    [ServiceContract(Name="IBsp2301", Namespace = http://172.xx.xxx.xxx:8801/MyService/Bsp2301, ConfigurationName="IBsp2301")]
        public interface IBsp2301

    When I put the service on each server I would modify the Namespace to reflect the IP of the server I was hosting the WCF service on.

    So, one service had an endpoint of 172.xx.xx.001:8801/MyService/Bsp2301 and the other had 172.xx.xx.002:8801/MyService/Bsp2301.

    Those two Namespaces need to match.  They cannot differ.  So, I could make them both 172.xx.xx.001:8801.  But, another solution was to use http://Microsoft.ServiceModel.Samples in both.

    Thanks!


    Wednesday, January 8, 2014 9:40 PM