wcfendpointsendpointbehavior

How to add a default endpoint behaviors to all services


I'm attempting to add an endpoint behavior to all services of a host.

So for example, I have a couple of .svc ServiceHost declarations and I want to know how I would be able to configure this via Web.config.

Any ideas? Thanks.


Solution

  • Create custom class derived from ServiceHost and custom class derived from ServiceHostFactory. In your custom ServiceHost implementation add needed behaviors. Here you have example.