示例#1
0
        public static void MainBase(string _identify)
        {
            if (IsStartBase == true)
            {
                return;
            }
            IsStartBase = true;//设置为开启

            //SetUpPluginUpgrade();

            IsRootMNode = HostSettingConfig.GetValue("rootmnode") == "1" ? true : false;
            IsDebug     = HostSettingConfig.GetValue("debug") == "1" ? true : false;
            Identify    = _identify;
            HostName    = HostSettingConfig.GetValue("hostname");

            IsCompressJson   = HostSettingConfig.GetValue("compress") == "1" ? true : false;
            IsEncryptionJson = HostSettingConfig.GetValue("encryption") == "1" ? true : false;
            serializeType    = (SerializeType)Convert.ToInt32(HostSettingConfig.GetValue("serializetype"));
            IsOverTime       = HostSettingConfig.GetValue("overtime") == "1" ? true : false;
            OverTime         = Convert.ToInt32(HostSettingConfig.GetValue("overtimetime"));
            IsToken          = HostSettingConfig.GetValue("token") == "1" ? true : false;
            MongoConnStr     = HostSettingConfig.GetValue("mongodb_conn");



            WcfGlobal.Run(StartType.BaseService);
            WcfGlobal.Run(StartType.FileService);
            WcfGlobal.Run(StartType.HttpService);
            WcfGlobal.Run(StartType.SuperClient);
            WcfGlobal.Run(StartType.MiddlewareTask); //定时任务

            CoreFrame.SSO.SsoHelper.Start();         //单点登录启动

            GetAllConfig();                          //获取所有配置
        }
示例#2
0
        public static void Main()
        {
            IsDebug      = HostSettingConfig.GetValue("debug") == "1" ? true : false;
            HostName     = HostSettingConfig.GetValue("hostname");
            IsToken      = HostSettingConfig.GetValue("token") == "1" ? true : false;
            MongoConnStr = HostSettingConfig.GetValue("mongodb_conn");

            WcfGlobal.Run(StartType.KillAllProcess);
            if (Convert.ToInt32(HostSettingConfig.GetValue("wcfservice")) == 1)
            {
                WcfGlobal.Run(StartType.BaseService);
            }
            if (Convert.ToInt32(HostSettingConfig.GetValue("filetransfer")) == 1)
            {
                WcfGlobal.Run(StartType.FileService);
            }

            if (Convert.ToInt32(HostSettingConfig.GetValue("router")) == 1)
            {
                WcfGlobal.Run(StartType.RouterBaseService);
                WcfGlobal.Run(StartType.RouterFileService);
            }

            WcfGlobal.Run(StartType.SuperClient);

            if (Convert.ToInt32(HostSettingConfig.GetValue("mongodb")) == 1)
            {
                WcfGlobal.Run(StartType.MongoDB);
            }

            if (Convert.ToInt32(HostSettingConfig.GetValue("timingtask")) == 1)
            {
                WcfGlobal.Run(StartType.MiddlewareTask);
            }

            WcfGlobal.Run(StartType.PublishService);
            if (Convert.ToInt32(HostSettingConfig.GetValue("nginx")) == 1)
            {
                WcfGlobal.Run(StartType.Nginx);
            }
        }
示例#3
0
        public static void Run(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                mAppHost = new ServiceHost(typeof(BaseService));
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "wcfserver", 30);

                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                AppGlobal.appType     = AppType.WCF;
                AppGlobal.IsSaas      = System.Configuration.ConfigurationManager.AppSettings["IsSaas"] == "true" ? true : false;
                AppGlobal.AppStart();


                ClientManage.IsHeartbeat      = HostSettingConfig.GetValue("heartbeat") == "1" ? true : false;
                ClientManage.HeartbeatTime    = Convert.ToInt32(HostSettingConfig.GetValue("heartbeattime"));
                ClientManage.IsMessage        = HostSettingConfig.GetValue("message") == "1" ? true : false;
                ClientManage.MessageTime      = Convert.ToInt32(HostSettingConfig.GetValue("messagetime"));
                ClientManage.IsCompressJson   = HostSettingConfig.GetValue("compress") == "1" ? true : false;
                ClientManage.IsEncryptionJson = HostSettingConfig.GetValue("encryption") == "1" ? true : false;
                ClientManage.IsToken          = HostSettingConfig.GetValue("token") == "1" ? true : false;
                ClientManage.serializeType    = (SerializeType)Convert.ToInt32(HostSettingConfig.GetValue("serializetype"));
                ClientManage.IsOverTime       = HostSettingConfig.GetValue("overtime") == "1" ? true : false;
                ClientManage.OverTime         = Convert.ToInt32(HostSettingConfig.GetValue("overtimetime"));

                ClientManage.StartHost();
                mAppHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据服务启动完成");
                break;

            case StartType.FileService:
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mFileHost = new ServiceHost(typeof(FileService));
                mFileHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件服务启动完成");
                break;

            case StartType.RouterBaseService:
                mRouterHost = new ServiceHost(typeof(RouterBaseService));
                RouterManage.Start();
                mRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据路由服务启动完成");
                break;

            case StartType.RouterFileService:
                mFileRouterHost = new ServiceHost(typeof(RouterFileService));
                mFileRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件路由服务启动完成");
                break;

            case StartType.SuperClient:
                SuperClient.CreateSuperClient();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "超级客户端启动完成");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StartTask();    //开启定时任务
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "定时任务启动完成");
                break;

            case StartType.PublishService:    //订阅
                PublishServiceManage.InitPublishService();
                PublishSubManager.StartPublish();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "发布订阅服务完成");
                break;

            case StartType.MongoDB:
                MongodbManager.StartDB();    //开启MongoDB
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "MongoDB启动完成");
                break;

            case StartType.Nginx:
                NginxManager.StartWeb();    //开启Nginx
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "Nginx启动完成");
                break;

            case StartType.KillAllProcess:
                MongodbManager.StopDB();    //停止MongoDB  清理掉所有子进程,因为主进程关闭子进程不关闭的话,占用的端口号一样不会释放
                NginxManager.StopWeb();
                break;
            }
        }
示例#4
0
        public static void Run(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                mAppHost = new ServiceHost(typeof(BaseService));
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "wcfserver", 30);

                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                AppGlobal.appType     = AppType.WCF;
                AppGlobal.IsSaas      = HostSettingConfig.GetValue("issaas") == "1" ? true : false;
                AppGlobal.AppStart();


                ClientManage.IsHeartbeat   = HostSettingConfig.GetValue("heartbeat") == "1" ? true : false;
                ClientManage.HeartbeatTime = Convert.ToInt32(HostSettingConfig.GetValue("heartbeattime"));

                ClientManage.StartHost();
                mAppHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据服务启动完成");
                break;

            case StartType.FileService:
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mFileHost = new ServiceHost(typeof(FileService));
                mFileHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件服务启动完成");
                break;

            case StartType.HttpService:
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "httpserver", 30);
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mHttpHost = new WebServiceHost(typeof(HttpService));
                mHttpHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "Http服务启动完成");
                break;

            case StartType.RouterBaseService:
                mRouterHost = new ServiceHost(typeof(RouterBaseService));
                RouterManage.Start();
                mRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "路由数据服务启动完成");
                break;

            case StartType.RouterFileService:
                mFileRouterHost = new ServiceHost(typeof(RouterFileService));
                mFileRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "路由文件服务启动完成");
                break;

            case StartType.SuperClient:
                SuperClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "超级客户端启动完成");

                PublisherManage.Start();
                SubscriberManager.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "发布订阅启动完成");

                DistributedCacheManage.Start();
                DistributedCacheClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "分布式缓存启动完成");

                UpgradeManage.Start();
                UpgradeClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "升级包管理启动完成");

                MonitorTirggerManage.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "监视触发器启动完成");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StartTask();    //开启定时任务
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "定时任务启动完成");
                break;
            }
        }