AddressFilter mismatch at the EndpointDispatcher RRS feed

  • Question

  • I have WCF service. At beginning of developing my service, I created unit test against the service; add the server reference; I can call my service methods without any problem. Then I deployed my service to the our dev server box and changed the server reference to the dev box url in my unit test. After everything worked fine for dev box, I switched back my server reference to my local box in the unit test, now I get this

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

    error all the time using my local wcf service, but no problem calling my dev wcf service.

    I can fix the problem by adding service behavior to set AddressFilterMode = AddressFilterMode.Any

    However, I want to know why without setting AddressFilterMode.Any my local wcf service doesn't work? Where is the mismatch? How can I see the mismatch? I checked the web.config on my local service and on dev service is same. I also checked the client app.config, they are same except the server name is different. I also regenerated service proxy via VS Add Server reference. But nothing worked. Can anyone help me out here? Thanks in advance!!!

    Wednesday, July 17, 2013 11:43 PM

All replies

  • Hi,

    It seems the endpoint url used at client is not matching the one at the service-side. This is a common problem when the client access the service through an intermediate node

    When self-hosted, the EndpointAddress of the service comes from the IIS base address (host headers).  In this case, it appears to be the "our-server" address.  By default, WCF ensures that the To of each Message matches the intended address.  
    If the service just has this one endpoint, a quick workaround would be to use 
    [ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]which turns off the address filter.  Otherwise, ensure the IIS host headers contain the 'public facing base address' that you want clients to connect to, so that messages will be properly addressed to the service.

    #ServiceBehaviorAttribute.AddressFilterMode: .

    Hope it can help you.

    Best Regards.

    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 18, 2013 8:35 AM
  • In my case, there is no intermediate node. My unit test calls the WCF service directly. My point is that it worked at the beginning and suddenly it doesn't work anymore. My service is hosted in IIS. My service is deployed 2 different machines. One works, one doesn't - my unit test calls to the service on different machine.

    You said "By default, WCF ensures that the To of each Message matches the intended address. "

    How can I see the To of my Message via code?


    Thursday, July 18, 2013 4:29 PM
  • I just realized when I ran the selected test, I didn't get AddressFilter mismatch error. My unit test passed successfully. However, when I debugged the selected test, I did get AddressFilter mismatch error.

    I also turned on svc log via web.config. When I ran the selected test, the log was generated. I looked at the Message tab, there are 4 actions related to PrepareShipment. First two use the correct service namespace; the third and fourth ones use as service namespace. Why? Here is the screen shot:

    Why debugging causes  AddressFilter mismatch error? Why debugging failed, there is no svc log created. So I cannot see the To of the Message. Do we have other way to see To via code - client side code?


    Thursday, July 18, 2013 11:38 PM