Action cannot be processed due to ContractFilter mismatch at the EndpointDispatcher

1k views Asked by At

I am trying to get a simple webservice running that sends emails out upon being triggered but I am getting the following error when trying to set it up:

The message with Action 'localhost/IFabricService/StartMailRun' 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).'.

My service is coded as follows:

namespace Project.Fabric
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IFabricService
{
    [OperationContract(IsOneWay=true)]
    void StartMailRun(int id, string customerGuid);

}


// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType
{
    bool boolValue = true;
    string stringValue = "Hello ";

    [DataMember]
    public bool BoolValue
    {
        get { return boolValue; }
        set { boolValue = value; }
    }

    [DataMember]
    public string StringValue
    {
        get { return stringValue; }
        set { stringValue = value; }
    }
}

}

This is called from within a class library that called Project.Biz with the file being called EmailBiz.cs using the following code:

public void StartEmailRun(int id)
    {
        WS2007HttpBinding myBinding = new WS2007HttpBinding();
        myBinding.Security.Mode = SecurityMode.TransportWithMessageCredential;
        myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;

        // Create the endpoint address.
        EndpointAddress ea = new EndpointAddress("https://fabric.metalearning.net/FabricService.svc");

        // Create the client.                       
        MetaLearning.Fabric.Console.ServiceReference1.FabricServiceClient svc = new MetaLearning.Fabric.Console.ServiceReference1.FabricServiceClient(myBinding, ea);


        // Specify a certificate to use for authenticating the client.
        svc.ClientCredentials.ClientCertificate.SetCertificate(
        StoreLocation.LocalMachine,
        StoreName.My,
        X509FindType.FindByThumbprint,
        "thumbprinthere");

        // Begin using the client.
        try
        {
            svc.Open();
            //this will need changed to include correct string of GUID and correct ID for email campaign.
            svc.StartMailRun(id, "a67f8076-82c6-427c-ac34-fb34aee59e0b");
            System.Console.ReadLine();

            // Close the client.
            svc.Close();
        }
        catch (Exception ex)
        {
        }  
    }

The web.config of the Fabric service looks as follows:

<system.serviceModel>
<services>
  <service behaviorConfiguration="ServiceCredentialsBehaviour" name="MetaLearning.Fabric.FabricService">
    <endpoint binding="ws2007HttpBinding" bindingConfiguration="WSHttpBinding_IFabricService" name="SecuredByClientCertificate" contract="MetaLearning.Fabric.IFabricService" />
  </service>
</services>
<bindings>
  <ws2007HttpBinding>
    <binding name="WSHttpBinding_IFabricService">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="Certificate" />
      </security>
    <!--<security mode="Transport"> 
      <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
      <message clientCredentialType="Certificate" algorithmSuite="Default" />
    </security>--> 
    </binding>
  </ws2007HttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceCredentialsBehaviour">
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceMetadata httpsGetEnabled="true" />
      <serviceCredentials>
        <serviceCertificate findValue="thumbprinthere" x509FindType="FindByThumbprint" storeLocation="LocalMachine" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
    <add binding="ws2007HttpBinding" scheme="https" />
</protocolMapping>    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />

Can anyone see what I am overlooking that would be causing this issue?

0

There are 0 answers