wcf - How to invoke MessageInspector and ParameterInspector without adding entries in Web.config -


i able invoke parameterinspectors , messageinpectors in wcf service adding required entries in web.config there way invoke inspectors without adding entries in web.config?

here's basic example. assume have class called customservicehost derives servicehost, , have 2 behaviors - myparameterinspector , mymessageinspector.

in code customservicehost, override applyconfiguration method add behaviors (don't forget call base method well):

public class customservicehost : servicehost {      protected override void applyconfiguration()     {          base.applyconfiguration();         this.description.add.behaviors(new myparameterinspector());         this.description.add.behaviors(new mymessageinspector());     } } 

note i've shown portions of code relevant.

if you're hosting service in iis, you'll need implement custom service host factory creates instance of service host. applyconfiguration() method called when host instantiated.

you can check following links carlos figueira msdn blog, have code snippets:

wcf extensibility - iparameterinspector

wcf extensibility - message inspectors


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -