O'Reilly logo

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications by Steven Cheng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Specifying a dedicated service instance for a singleton service

Normally, when hosting a WCF service, we only need to specify the service type in the ServiceHost and the runtime will help create the service instance internally, according to the InstanceContextMode we apply on the service class. This makes hosting a WCF service quite simple and convenient; the service developers do not need to know when and how the runtime creates the service instance. However, in some cases, it is useful and necessary to let the developer control when and how the service instance is created.

Getting ready

Singleton is one of the popular design patterns. This pattern can help design a class that will expose one and only one instance of the class over the entire lifecycle ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required