Ejemplo n.º 1
0
 /// <summary>
 /// 启动事件
 /// </summary>
 /// <param name="args">启动参数</param>
 protected override void OnStart(string[] args)
 {
     try
     {
         _httpServer = new HttpServerHost();
         _httpServer.Start();
     }
     catch (Exception ex)
     {
         LogUtil.Error("服务启动失败:" + ex.ToString());
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 启动HTTP服务器
        /// </summary>
        private void StartHttpServer()
        {
            try
            {
                server = new HttpServerHost();
                server.Start();
            }
            catch (Exception ex)
            {
                LogUtil.Error("服务启动失败:" + ex.ToString());
            }

            this.Invoke(new Action(() => { label1.Text = "HttpServer已启动"; }));
        }