예제 #1
0
        public void Run()
        {
            if (_host == null)
            {
                var isSingle = IsSingle(_serviceType);
                _host = !isSingle
                    ? new ServiceHostProxy(_serviceType)
                    : new ServiceHostProxy(Activator.CreateInstance(_serviceType));

                if (!RuntimeUnity.ServiceHasConfig(ServiceType))
                {
                    _host.ApplyEndpoints(this);
                }
                LoadEndpointsInfomation();
            }
            try
            {
                if (_host.State != CommunicationState.Opening)
                {
                    _host.Open();
                }
            }
            catch
            {
                Info.State = Runtime.RunState.Error;
                _host.Abort();
                _host = null;
                throw;
            }
        }