Reputation: 21998
Is it possible to target DelegatingHandlers (message handlers) in WCF Web Api at specific requests (as is possible with an operation handler) or are message handlers global. By that I mean they are called for every request.
Upvotes: 0
Views: 518
Reputation: 4059
You could set up different configurations and map those configurations to the appropriate routes. So for example:
var config1 = new HttpConfiguration();
config1.MessageHandlers.Add(typeof(MyMessageHandler));
config1.MessageHandlers.Add(typeof(MyMessageHandler2));
var config2 = new HttpConfiguration();
config2.MessageHandlers.Add(typeof(MyMessageHandler3));
config2.MessageHandlers.Add(typeof(MyMessageHandler4));
RouteTable.Routes.MapServiceRoute<ContactService>("api/contacts", config1);
RouteTable.Routes.MapServiceRoute<InvoiceService>("api/invoices", config2);
Upvotes: 1