public void Stop(Guid id) { if (!_allApplicationInfos.ContainsKey(id)) { throw new DeployException("应用程序不存在"); } ApplicationRuntimeModel runtimeModel = _allApplicationInfos[id]; if (runtimeModel.ApplicationStatus != ApplicationStatusEnum.Runing) { throw new DeployException("应用程序尚运行"); } runtimeModel.Stop(); }
/// <summary> /// 复制应用程序 /// </summary> /// <param name="directoryInfo"></param> private void CopyApplication(DirectoryInfo directoryInfo) { string targetPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Application", directoryInfo.Name); ApplicationRuntimeModel runtimeModel = _applicationManage.GetRuntimeModelByPath(directoryInfo.Name); if (runtimeModel != null && runtimeModel.ApplicationInfo.ApplicationType != ApplicationTypeEnum.StaticDocument) { runtimeModel.Stop(); if (runtimeModel.ApplicationStatus == ApplicationStatusEnum.Stop) { CopyDirectory(directoryInfo, targetPath); } else { throw new DeployException("应用程序关闭失败"); } } CopyDirectory(directoryInfo, targetPath); }