WCF/WF - How to access the multiple svc file in selfhost

Asked By MySpider DotNet on 23-Dec-10 03:41 AM
Hi,

   Am using Wcf  as self host service later i will convert it to windows service. Now i am using onc wcf file if i go adding different WCF service file for each module how can i access it in client side, because in self hosting wcf i define only one wcf file as below

  ServiceHost myServiceHost = null;          
            Uri baseAddress = new Uri("net.tcp://localhost:2000/myservice");                    

            myServiceHost = new ServiceHost(typeof(Service1), baseAddress);
            myServiceHost.AddServiceEndpoint(typeof(IService), binding, baseAddress);

            myServiceHost.Open(); 
            Console.WriteLine("\n Hit Enter to STOP Service");            
            Console.ReadLine();
            myServiceHost.Close();

This how i write my self hosted wcf. If i go for mulitple file, in wcf, wheather i have to go for writing same set of line of
line for each wcf file or is there is any other alternate method for this
Indranil Chatterjee replied to MySpider DotNet on 27-Dec-10 05:46 AM
A single host is teid to a single service type only. If you have to host multiple service types, you have tocreate that many hosts. In short, yes, you have to repeat these lines of code.