Come posso ottenere WCF Routing per darmi un messaggio di errore più dettagliato di quello - Nessuna corrispondenza MessageFilter?

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

  •  26-10-2019
  •  | 
  •  

Domanda

C'è un modo per configurare WCF routing in modo che se i filtri non corrispondono è possibile ottenere ulteriori informazioni sul messaggio che non poteva essere instradato?

Al momento stiamo utilizzando AppFabric e abbiamo solo il seguente messaggio. Questo messaggio non è molto utile quando si cerca di capire quale messaggio non corrisponde un filtro.

No matching MessageFilter was found for the given Message.
È stato utile?

Soluzione

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();
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top