I have registered a WCF service with WindsorContainer like this:
var container = new WindsorContainer();
container.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero);
container.Register(
Component.For<ITestService>()
.ImplementedBy<TestService>()
.Named("TestService")
.AsWcfService());
The TestService
object is instantiated when first WCF request is created.
What I'd like instead is to manually instantiate it at time when I want to, like this:
container.Resolve<ITestService>();
(eg. when user clicks the "Turn ON" button from the GUI).
Clients should simply get error when connecting, until service is started.
How can I accomplish this?