This project is read-only.

MessageHandler as Singleton difference between prev 4 vs prev 5

Topics: Web Api
Oct 4, 2011 at 11:22 AM

We have a set of apis / service contracts. We create all of them as singletons.

All of them use a message handler. We need 2 different message handlers. Let say 4 apis are using same message handler and 5th one is using his own.

In prev 4 we set 2 configurations: one per each message handler and multiple apis were using same config.

In prev 5 this solution is no longer working: to make it working I had to set 1 configuration(my own class inheriting from WebApiConfiguration) per each Api/Service contract where each config is using its own message handler.

In prev 5 message handlers are created same as servce cantracts through an ioc container(windsor) as singleton as well. (See

Changing creation policy for api+message handler from singleton to transient makes possible to reuse same configuration.

Could you please confirm we are on the right track for a "singleton base" enviroment?