using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Learun.Loger;
using Learun.Util;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Hosting;
using Owin;

[assembly: OwinStartup(typeof(Quanjiang.DigitalSchool.IMServerService.Startup1))]
namespace Quanjiang.DigitalSchool.IMServerService
{
    public partial class QuanjiangDigitalSchollIMService : ServiceBase
    {
        private Log log = LogFactory.GetLogger("QuanjiangDigitalSchollIMService");
        public QuanjiangDigitalSchollIMService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            string SignalRURI = Config.GetValue("IMUrl");
            try
            {
                WebApp.Start(SignalRURI);
                log.Info(new { Browser = "QuanjiangDigitalSchollIMService", Content = "服务已启动" });
            }
            catch (Exception e)
            {
                log.Error(new { Browser = "QuanjiangDigitalSchollIMService", Content = "服务启动异常" + e.Message+e.StackTrace });
            }
        }

        protected override void OnStop()
        {
        }
    }
}