How can I get WCF Routing to give me a more detailed error message than - No matching MessageFilter?

StackOverflow https://stackoverflow.com/questions/6311423

  •  26-10-2019
  •  | 
  •  

سؤال

Is there a way to configure WCF Routing so that if your filters don't match you can get more information about the message that could not be routed?

Currently we're using AppFabric and we only get the following message. This message is not very helpful when trying to figure out which message did not match a filter.

No matching MessageFilter was found for the given Message.
هل كانت مفيدة؟

المحلول

this is not the best solution, I have been experimenting a way to verify that a routing service is working as configured, but haven't found the best way yet.

But one way is to provide a match all filter, and have a service which accepts all requests and logs it, and returns a 404 back to the client

    <routing>
        <filters>
            <filter name="Other" filterType="MatchAll" />
            <filter name="action1" filterType="Action" filterData="http://tempuri.org/action2" />
            <filter name="action2" filterType="Action" filterData="http://tempuri.org/action1" />
        </filters>
        <filterTables>
            <filterTable name="FilterTable">
                <add filterName="action1" endpointName="Service1" priority="1" />
                <add filterName="action2" endpointName="Service2" priority="1" />
                <add filterName="Other" endpointName="Logger" priority="0" />
            </filterTable>
        </filterTables>
    </routing>

The Logger end point simply points to a simple service which accepts a Message and logs it, and returns a 404

some psudo code:

[ServiceBehavior]
public class RoutingLogger : IYourInterface
{
    public System.ServiceModel.Channels.Message YourInterfaceMethod(System.ServiceModel.Channels.Message message)
    {
        LogMessage(message);
        return new Custom404Message();
    }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top