Search code examples
c#wcfserviceservicehost

Can 2 instance of ServiceHost be in one application?


I have the app, where already there is the service.

ServiceHost serviceHost = null;
serviceHost = new ServiceHost(typeof(*.*.*.*.com.MapViewPortTypeClient), new Uri(uri));

Can i create another instance of ServiceHost in this application, for example:

ServiceHost serviceHostKW = null;
serviceHostKW = new ServiceHost(typeof(*.*.*.*.com.ClientKW), new Uri(uriKW));

So after this it will be 2 services (servers) in this app. Will I have any problems?


Solution

  • Yes you can create as many ServiceHost instances, as you want.. but obviously url:port should be different