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; } }
public static void Quit(StartType type) { 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.HttpService: try { if (mHttpHost != null) { mHttpHost.Close(); MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "Http服务已关闭!"); } } catch { if (mHttpHost != null) { mHttpHost.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: UpgradeManage.Stop(); UpgradeClient.Stop(); MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "升级包服务已停止"); SuperClient.Stop(); 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; } }