标签:
WCF服务。利用循环,读取配置文件,一次性将所有的服务全部开启
public void hostopen() { Configuration conf = ConfigurationManager.OpenExeConfiguration(Assembly.GetEntryAssembly().Location); ServiceModelSectionGroup svcmod = (ServiceModelSectionGroup)conf.GetSectionGroup("system.serviceModel"); foreach (ServiceElement el in svcmod.Services.Services) { Type svcType = Type.GetType(el.Name + "," + "Wcf_DaBu_Service"); if (svcType == null) throw new Exception("Invalid Service Type " + el.Name + " in configuration file."); ServiceHost aServiceHost = new ServiceHost(svcType); aServiceHost.Open(); MessageBox.Show(el.Name + "+iiiiiii"); } }
标签:
原文地址:http://www.cnblogs.com/chcong/p/4301763.html