/// <summary> /// 私有构造 /// </summary> private WcfServer() { this.services = new List<ServiceHost>(); //加载配置文件 WcfServiceSetting config = new WcfServiceSetting(); this.wcfSetting = config.WcfSetting; this.constantSetting = config.ConstantSetting; }
/// <summary> /// 停止服务 /// </summary> public void Stop() { isStop = true; foreach (ServiceHost service in services) { if (service.State != CommunicationState.Closed) { service.Close(); } } services = null; wcfSetting = null; constantSetting = null; WcfFaultedEvent = null; ReleaseInstance(); }