Message with "..." could not be processed in the receiver due to an AddressFilter mismatch in the EndpointDispatcher

I am trying to implement WCF Rest service without modifying the App.config file .

My service interface looks like this:

public interface IService
    [WebInvoke(Method = "POST",
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare,
        UriTemplate = "/teststr/?string={aStr}")]
    string TestString(string aStr);


The implementation of the Service is very simple:

public class TestService : IService
    public string TestString(string aStr = null)
        Console.WriteLine("The Test() method was called at {0}"
            + "\n\rThe given string was {1}\n\r"
            , DateTime.Now.ToString("H:mm:ss")
            , aStr);

        return aStr;


And my main program that runs everything:

// Step 1 Create a URI to serve as the base address.
Uri baseAddress = new Uri("http://localhost:8000/ServiceSample/");

// Step 2 Create a ServiceHost instance
ServiceHost selfHost = new ServiceHost(typeof(TestService), baseAddress);

    // Step 3 Add a service endpoint.
    selfHost.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), 

    // Step 4 Enable metadata exchange.
    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    smb.HttpGetEnabled = true;

    // Step 5 Start the service.
    Console.WriteLine("The service is ready.");
    Console.WriteLine("Press <ENTER> to terminate service.");

    // Close the ServiceHostBase to shutdown the service.
catch (CommunicationException ce)
    Console.WriteLine("An exception occurred: {0}", ce.Message);


When I run this and enter the following url:



I am getting this message:

// The message with To '...' cannot be processed at the receiver, due to an 
// AddressFilter mismatch at the EndpointDispatcher. Check that the sender
// and receiver EndpointAddresses agree.


I've looked at similar SO questions suggesting I add a <webHttp/>

(but doesn't Step 4

it already?) Others said adding [ServiceBehavior ..] . None of these worked and I didn't find the related SO questions helpful.

Do I need to change the App.config file? What am I doing wrong here?


source to share

1 answer

I realize there is an answer in the comments, but I will try to point out what I learned while trying to find a solution to my problem as this is the first page that comes up on Google by searching for the error message.

I was trying to call a third party SOAP web service from JavaScript (terrible I know) and I ran into this problem.

The SOAP 1.2 service I was calling required me to place the :To

SOAP Addressing header in <soap:Header>


. By doing this and also adding :Action

which I got from WSDL I was golden.

In the end, the SOAP header looked like this:

<soap:Header xmlns:wsa="">
    <wsa:To>(WebService URL)</wsa:To>
    <wsa:Action>(Action from WebService WSDL)</wsa:Action>


Useful sites:



All Articles