How to host 2 WCF services in 1 Windows Service?

前端 未结 4 750
再見小時候
再見小時候 2021-02-04 16:47

I have a WCF application that has two Services that I am trying to host in a single Windows Service using net.tcp. I can run either of the services just fine, but as soon as I t

4条回答
  •  春和景丽
    2021-02-04 17:34

                Type serviceAServiceType = typeof(AfwConfigure);
                Type serviceAContractType = typeof(IAfwConfigure);
    
                Type serviceBServiceType = typeof(ConfigurationConsole);
                Type serviceBContractType = typeof(IConfigurationConsole);
    
                Type serviceCServiceType = typeof(ConfigurationAgent);
                Type serviceCContractType = typeof(IConfigurationAgent);
    
                ServiceHost serviceAHost = new ServiceHost(serviceAServiceType);
                ServiceHost serviceBHost = new ServiceHost(serviceBServiceType);
                ServiceHost serviceCHost = new ServiceHost(serviceCServiceType);
                Debug.WriteLine("Enter1");
                serviceAHost.Open();
                Debug.WriteLine("Enter2");
                serviceBHost.Open();
                Debug.WriteLine("Enter3");
                serviceCHost.Open();
                Debug.WriteLine("Opened!!!!!!!!!");
    

提交回复
热议问题