Пример #1
0
        public static void ExitBase()
        {
            if (IsStartBase == false)
            {
                return;
            }
            IsStartBase = false;//设置为开启

            MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "正在准备关闭中间件服务,请等待...");
            ClientLinkManage.UnAllConnection();//关闭所有连接

            WcfGlobal.Quit(StartType.MiddlewareTask);
            WcfGlobal.Quit(StartType.SuperClient);
            WcfGlobal.Quit(StartType.BaseService);
            WcfGlobal.Quit(StartType.FileService);
            WcfGlobal.Quit(StartType.HttpService);
        }
Пример #2
0
        public static void Quit(StartType type)
        {
            ClientLinkManage.UnAllConnection();//关闭所有连接
            switch (type)
            {
            case StartType.BaseService:
                try
                {
                    if (mAppHost != null)
                    {
                        EFWCoreLib.WcfFrame.ClientLinkPoolCache.Dispose();
                        ClientManage.StopHost();
                        mAppHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据服务已关闭!");
                    }
                }
                catch
                {
                    if (mAppHost != null)
                    {
                        mAppHost.Abort();
                    }
                }
                break;

            case StartType.FileService:
                try
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件传输服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Abort();
                    }
                }
                break;

            case StartType.RouterBaseService:
                try
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Abort();
                    }
                }
                break;

            case StartType.RouterFileService:
                try
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Abort();
                    }
                }
                break;

            case StartType.SuperClient:
                SuperClient.UnCreateSuperClient();
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "超级客户端已关闭!");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StopTask();    //停止任务
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "定时任务已停止!");
                break;

            case StartType.PublishService:    //订阅
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "订阅服务已停止");
                break;

            case StartType.MongoDB:
                MongodbManager.StopDB();    //停止MongoDB
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "MongoDB已停止");
                break;

            case StartType.Nginx:
                NginxManager.StopWeb();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "Nginx已停止");
                break;
            }
        }