开发者

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

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?

Curr开发者_Python百科ently 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();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜