Reputation: 10888
I have two Services called TemplateService, TemplateReportService (both defined in one WCF Service Library) to be exposed to the client application.
How can I host these two services under one Windows Service?
Please guide.
Thank you!
Upvotes: 0
Views: 1270
Reputation: 46034
In the app.config for your Windows service, define a unique endpoint for each WCF service. Then in the OnStart() method of your Windows service, create a ServiceHost instance for each WCF service class.
Upvotes: 0
Reputation: 754250
Yes, sure, no problem - you just need to open two service hosts:
protected override void OnStart(string[] args)
{
ServiceHost host1 = new ServiceHost(typeof(Service1));
ServiceHost host2 = new ServiceHost(typeof(Service2));
host1.Open();
host2.Open();
}
and of course you need to have the appropriate config entries for those two separate services in the Windows service's app.config file.
Marc
Upvotes: 3