Beispiel #1
0
        protected override void OnStart(string[] args)
        {
            Logger.Info("Starting ChatReceiver...");
            try
            {
                chat = new ChatReceiver();
                Logger.Info("ChatReceiver started");
            }
            catch (Exception ex)
            {
                Logger.Error("OnStart: error in ChatServer", ex);
                throw;
            }

            Logger.Info("Opening chat host...");
            serviceHostChat = new ServiceHost(chat);
            try
            {
                serviceHostChat.Open();
                Logger.Info("Chat host is opened");
            }
            catch (Exception ex)
            {
                Logger.Error("OnStart: error in chat host opening", ex);
                throw;
            }

            Logger.Info("Starting WebChatReceiver...");
            try
            {
                webChat = new WebChatReceiver(chat.Manager);
                Logger.Info("WebChatReceiver started");
            }
            catch (Exception ex)
            {
                Logger.Error("OnStart: error in ChatServer", ex);
                throw;
            }

            Logger.Info("Opening webchat host...");
            serviceHostWebChat = new ServiceHost(webChat);
            try
            {
                serviceHostWebChat.Open();
                Logger.Info("WebChat host is opened");
            }
            catch (Exception ex)
            {
                Logger.Error("OnStart: error in webchat host opening", ex);
                throw;
            }

            Logger.Info("Creating module status controller");
            serviceHostStatus = new ServiceHost(ModuleStatusController.Instance);
            try
            {
                serviceHostStatus.Open();
                Logger.Info("Module status controller host is ready");
            }
            catch (Exception ex)
            {
                Logger.Error("OnStart: error in module status host opening", ex);
                throw;
            }
        }