Пример #1
0
        public void Start()
        {
            try
            {
                "初始化通讯服务对象".Info();

                _Srv = new CStarterController();

                "初始化通讯服务配置".Info();
                string.Format("通讯服务监听地址:net.pipe://localhost/{0}/{1}/comm", ServiceContext.Current.Domain, ServiceContext.Current.Name).Info();

                _Host = new ServiceHost(_Srv, new Uri(
                                            string.Format("net.pipe://localhost/{0}/{1}",
                                                          ServiceContext.Current.Domain,
                                                          ServiceContext.Current.Name)));
                _Host.AddServiceEndpoint(typeof(ICStarterControl), new NetNamedPipeBinding(), "comm");

                "开启监听服务".Info();

                _Host.Open();

                _IsStarted = true;
            }
            catch (Exception eX)
            {
                eX.Message.Error();
                eX.Exception();
            }
        }
        public void Start()
        {
            try
            {
                "初始化通讯服务对象".Info();

                _Srv = new CStarterController();

                "初始化通讯服务配置".Info();
                string.Format("通讯服务监听地址:net.pipe://localhost/{0}/{1}/comm", ServiceContext.Current.Domain, ServiceContext.Current.Name).Info();

                _Host = new ServiceHost(_Srv, new Uri(
                    string.Format("net.pipe://localhost/{0}/{1}",
                    ServiceContext.Current.Domain,
                    ServiceContext.Current.Name)));
                _Host.AddServiceEndpoint(typeof(ICStarterControl), new NetNamedPipeBinding(), "comm");

                "开启监听服务".Info();

                _Host.Open();

                _IsStarted = true;
            }
            catch (Exception eX)
            {
                eX.Message.Error();
                eX.Exception();
            }
        }
        public void Dispose()
        {
            Stop();

            if (null != _Srv)
                _Srv = null;
        }
Пример #4
0
        public void Dispose()
        {
            Stop();

            if (null != _Srv)
            {
                _Srv = null;
            }
        }