tags:

views:

81

answers:

2

Hello there,

I have two Services called TemplateService, TemplateReportService (both defined in one WCF Service Library) to be exposed to the client application.

Is it possible to host these two services under one Windows Service?

Thank you!

+4  A: 

Yes, it is possible. Create two ServiceHost with different endpoints and open both of them when starting the windows service. You can even use the same port (if using net.tcp bindings) by enabling port sharing.

MattK
Thanks for your reply. Okie.. I have added two ServiceHost with different endpoints in hosting Windows Service. Now in client application, how can I call both service methods by adding just one service reference? Please guide.
inutan
Typically, you would generate a different client proxy for each endpoint. If you need to use the same client proxy for both, you will need to do some manual editing to accomplish this or utilize ChannelFactory to be even more explicit about which endpoint you are calling.
MattK
+1  A: 

I personally hosted more than 80 services in one process by scanning a specific directory for assemblies with services inside (reflection). This was running on a quite powerful machine (8 cores, 16GB) with thousands of users. Shortly after finishing this I found this link: http://blogs.microsoft.co.il/blogs/alon/archive/2008/03/12/hosting-plug-in-wcf-services.aspx which is basicly doing the same but with a better separation between service hosts by using application domains. On a second try I would use this host.

Marc Wittke