diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs index 9864b1c0..cd5f2de0 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs @@ -392,9 +392,9 @@ namespace IRaCIS.Core.Application.Services ProtocolName = dataset.GetSingleValueOrDefault(DicomTag.ProtocolName, string.Empty), ImagerPixelSpacing = dataset.GetSingleValueOrDefault(DicomTag.ImagerPixelSpacing, string.Empty), - AcquisitionTime = dataset.GetSingleValueOrDefault(DicomTag.ImagerPixelSpacing, string.Empty), - AcquisitionNumber = dataset.GetSingleValueOrDefault(DicomTag.ImagerPixelSpacing, string.Empty), - TriggerTime = dataset.GetSingleValueOrDefault(DicomTag.ImagerPixelSpacing, string.Empty), + AcquisitionTime = dataset.GetSingleValueOrDefault(DicomTag.AcquisitionTime, string.Empty), + AcquisitionNumber = dataset.GetSingleValueOrDefault(DicomTag.AcquisitionNumber, string.Empty), + TriggerTime = dataset.GetSingleValueOrDefault(DicomTag.TriggerTime, string.Empty), SiteId = dicomStudy.SiteId, TrialId = dicomStudy.TrialId, diff --git a/PublishSite/PublishForm.Designer.cs b/PublishSite/PublishForm.Designer.cs index 6541aedd..5d1f6833 100644 --- a/PublishSite/PublishForm.Designer.cs +++ b/PublishSite/PublishForm.Designer.cs @@ -58,9 +58,10 @@ label2 = new Label(); startOrStopServiceTbox = new TextBox(); tabPage2 = new TabPage(); + groupBox6 = new GroupBox(); bakConfigSaveBtn = new Button(); startBakBtn = new Button(); - backPublishPath = new TextBox(); + backExePath = new TextBox(); label5 = new Label(); bakDbName = new TextBox(); label4 = new Label(); @@ -70,6 +71,15 @@ netCorePublishBtn = new Button(); vuePublishBtn = new Button(); openFileDialog1 = new OpenFileDialog(); + label7 = new Label(); + publishFileTBox = new TextBox(); + selectPublishFilePathBtn = new Button(); + sshVuePublishBtn = new Button(); + sshNetCorePublishBtn = new Button(); + publishFolderTBox = new TextBox(); + label8 = new Label(); + selectPublishFolderPathBtn = new Button(); + sshNetCorePublishBtn2 = new Button(); groupBox1.SuspendLayout(); groupBox3.SuspendLayout(); tabControl1.SuspendLayout(); @@ -77,6 +87,7 @@ groupBox4.SuspendLayout(); groupBox2.SuspendLayout(); tabPage2.SuspendLayout(); + groupBox6.SuspendLayout(); groupBox5.SuspendLayout(); SuspendLayout(); // @@ -88,10 +99,10 @@ groupBox1.Controls.Add(rb_local); groupBox1.Location = new Point(12, 175); groupBox1.Name = "groupBox1"; - groupBox1.Size = new Size(628, 116); + groupBox1.Size = new Size(796, 116); groupBox1.TabIndex = 1; groupBox1.TabStop = false; - groupBox1.Text = "环境"; + groupBox1.Text = "环境(服务的操作,备份操作作用的主机)"; // // rb_production // @@ -142,9 +153,9 @@ // groupBox3 // groupBox3.Controls.Add(logTBox); - groupBox3.Location = new Point(691, 24); + groupBox3.Location = new Point(844, 24); groupBox3.Name = "groupBox3"; - groupBox3.Size = new Size(559, 1048); + groupBox3.Size = new Size(621, 1048); groupBox3.TabIndex = 3; groupBox3.TabStop = false; groupBox3.Text = "日志"; @@ -153,7 +164,7 @@ // logTBox.Location = new Point(23, 21); logTBox.Name = "logTBox"; - logTBox.Size = new Size(517, 1013); + logTBox.Size = new Size(577, 1013); logTBox.TabIndex = 1; logTBox.Text = ""; // @@ -164,7 +175,7 @@ tabControl1.Location = new Point(12, 318); tabControl1.Name = "tabControl1"; tabControl1.SelectedIndex = 0; - tabControl1.Size = new Size(628, 687); + tabControl1.Size = new Size(796, 764); tabControl1.TabIndex = 4; // // tabPage1 @@ -174,7 +185,7 @@ tabPage1.Location = new Point(4, 26); tabPage1.Name = "tabPage1"; tabPage1.Padding = new Padding(3); - tabPage1.Size = new Size(620, 657); + tabPage1.Size = new Size(788, 734); tabPage1.TabIndex = 0; tabPage1.Text = "服务"; tabPage1.UseVisualStyleBackColor = true; @@ -197,14 +208,14 @@ groupBox4.Controls.Add(selectPathBtn); groupBox4.Location = new Point(20, 28); groupBox4.Name = "groupBox4"; - groupBox4.Size = new Size(538, 372); + groupBox4.Size = new Size(738, 430); groupBox4.TabIndex = 40; groupBox4.TabStop = false; groupBox4.Text = "服务创建与删除"; // // serviceConfigSaveBtn // - serviceConfigSaveBtn.Location = new Point(72, 278); + serviceConfigSaveBtn.Location = new Point(141, 348); serviceConfigSaveBtn.Name = "serviceConfigSaveBtn"; serviceConfigSaveBtn.Size = new Size(128, 40); serviceConfigSaveBtn.TabIndex = 41; @@ -214,15 +225,15 @@ // // servicePortTBox // - servicePortTBox.Location = new Point(141, 169); + servicePortTBox.Location = new Point(141, 220); servicePortTBox.Name = "servicePortTBox"; - servicePortTBox.Size = new Size(259, 23); + servicePortTBox.Size = new Size(366, 23); servicePortTBox.TabIndex = 40; // // label6 // label6.AutoSize = true; - label6.Location = new Point(71, 172); + label6.Location = new Point(71, 223); label6.Name = "label6"; label6.Size = new Size(32, 17); label6.TabIndex = 39; @@ -230,16 +241,15 @@ // // serviceNameTBox // - serviceNameTBox.Location = new Point(140, 33); + serviceNameTBox.Location = new Point(140, 52); serviceNameTBox.Name = "serviceNameTBox"; - serviceNameTBox.Size = new Size(259, 23); + serviceNameTBox.Size = new Size(366, 23); serviceNameTBox.TabIndex = 30; - serviceNameTBox.Text = "EI_Image_Viewer"; // // label10 // label10.AutoSize = true; - label10.Location = new Point(23, 36); + label10.Location = new Point(23, 55); label10.Name = "label10"; label10.Size = new Size(104, 17); label10.TabIndex = 28; @@ -247,7 +257,7 @@ // // deleteService_Btn // - deleteService_Btn.Location = new Point(417, 33); + deleteService_Btn.Location = new Point(589, 31); deleteService_Btn.Name = "deleteService_Btn"; deleteService_Btn.Size = new Size(95, 27); deleteService_Btn.TabIndex = 38; @@ -258,7 +268,7 @@ // label11 // label11.AutoSize = true; - label11.Location = new Point(-1, 82); + label11.Location = new Point(0, 114); label11.Name = "label11"; label11.Size = new Size(128, 17); label11.TabIndex = 29; @@ -266,7 +276,7 @@ // // createService_Btn // - createService_Btn.Location = new Point(276, 278); + createService_Btn.Location = new Point(379, 348); createService_Btn.Name = "createService_Btn"; createService_Btn.Size = new Size(128, 40); createService_Btn.TabIndex = 37; @@ -276,23 +286,22 @@ // // serviceDisplayNameTBox // - serviceDisplayNameTBox.Location = new Point(140, 79); + serviceDisplayNameTBox.Location = new Point(141, 111); serviceDisplayNameTBox.Name = "serviceDisplayNameTBox"; - serviceDisplayNameTBox.Size = new Size(259, 23); + serviceDisplayNameTBox.Size = new Size(366, 23); serviceDisplayNameTBox.TabIndex = 31; - serviceDisplayNameTBox.Text = "EI_Image_Viewer_DisplayName"; // // en_TBox // - en_TBox.Location = new Point(141, 214); + en_TBox.Location = new Point(140, 274); en_TBox.Name = "en_TBox"; - en_TBox.Size = new Size(259, 23); + en_TBox.Size = new Size(366, 23); en_TBox.TabIndex = 36; // // label9 // label9.AutoSize = true; - label9.Location = new Point(71, 130); + label9.Location = new Point(72, 172); label9.Name = "label9"; label9.Size = new Size(32, 17); label9.TabIndex = 32; @@ -301,7 +310,7 @@ // label1 // label1.AutoSize = true; - label1.Location = new Point(72, 214); + label1.Location = new Point(71, 274); label1.Name = "label1"; label1.Size = new Size(44, 17); label1.TabIndex = 35; @@ -309,14 +318,14 @@ // // exePathTbox // - exePathTbox.Location = new Point(140, 126); + exePathTbox.Location = new Point(141, 168); exePathTbox.Name = "exePathTbox"; - exePathTbox.Size = new Size(259, 23); + exePathTbox.Size = new Size(366, 23); exePathTbox.TabIndex = 33; // // selectPathBtn // - selectPathBtn.Location = new Point(417, 125); + selectPathBtn.Location = new Point(589, 123); selectPathBtn.Name = "selectPathBtn"; selectPathBtn.Size = new Size(95, 27); selectPathBtn.TabIndex = 34; @@ -330,16 +339,16 @@ groupBox2.Controls.Add(startServiceBtn); groupBox2.Controls.Add(label2); groupBox2.Controls.Add(startOrStopServiceTbox); - groupBox2.Location = new Point(19, 431); + groupBox2.Location = new Point(19, 495); groupBox2.Name = "groupBox2"; - groupBox2.Size = new Size(538, 187); + groupBox2.Size = new Size(739, 219); groupBox2.TabIndex = 39; groupBox2.TabStop = false; groupBox2.Text = "服务停止与启动"; // // stopServiceBtn // - stopServiceBtn.Location = new Point(261, 101); + stopServiceBtn.Location = new Point(380, 106); stopServiceBtn.Name = "stopServiceBtn"; stopServiceBtn.Size = new Size(128, 40); stopServiceBtn.TabIndex = 39; @@ -349,7 +358,7 @@ // // startServiceBtn // - startServiceBtn.Location = new Point(94, 101); + startServiceBtn.Location = new Point(142, 106); startServiceBtn.Name = "startServiceBtn"; startServiceBtn.Size = new Size(128, 40); startServiceBtn.TabIndex = 38; @@ -360,7 +369,7 @@ // label2 // label2.AutoSize = true; - label2.Location = new Point(71, 52); + label2.Location = new Point(60, 57); label2.Name = "label2"; label2.Size = new Size(56, 17); label2.TabIndex = 32; @@ -368,16 +377,17 @@ // // startOrStopServiceTbox // - startOrStopServiceTbox.Location = new Point(140, 49); + startOrStopServiceTbox.Location = new Point(141, 54); startOrStopServiceTbox.Name = "startOrStopServiceTbox"; - startOrStopServiceTbox.Size = new Size(259, 23); + startOrStopServiceTbox.Size = new Size(366, 23); startOrStopServiceTbox.TabIndex = 31; // // tabPage2 // + tabPage2.Controls.Add(groupBox6); tabPage2.Controls.Add(bakConfigSaveBtn); tabPage2.Controls.Add(startBakBtn); - tabPage2.Controls.Add(backPublishPath); + tabPage2.Controls.Add(backExePath); tabPage2.Controls.Add(label5); tabPage2.Controls.Add(bakDbName); tabPage2.Controls.Add(label4); @@ -386,14 +396,32 @@ tabPage2.Location = new Point(4, 26); tabPage2.Name = "tabPage2"; tabPage2.Padding = new Padding(3); - tabPage2.Size = new Size(620, 657); + tabPage2.Size = new Size(788, 734); tabPage2.TabIndex = 1; tabPage2.Text = "备份与发布"; tabPage2.UseVisualStyleBackColor = true; // + // groupBox6 + // + groupBox6.Controls.Add(sshNetCorePublishBtn2); + groupBox6.Controls.Add(selectPublishFolderPathBtn); + groupBox6.Controls.Add(label8); + groupBox6.Controls.Add(publishFolderTBox); + groupBox6.Controls.Add(sshNetCorePublishBtn); + groupBox6.Controls.Add(sshVuePublishBtn); + groupBox6.Controls.Add(selectPublishFilePathBtn); + groupBox6.Controls.Add(publishFileTBox); + groupBox6.Controls.Add(label7); + groupBox6.Location = new Point(6, 315); + groupBox6.Name = "groupBox6"; + groupBox6.Size = new Size(776, 413); + groupBox6.TabIndex = 43; + groupBox6.TabStop = false; + groupBox6.Text = "上传文件到远程服务器发布"; + // // bakConfigSaveBtn // - bakConfigSaveBtn.Location = new Point(134, 207); + bakConfigSaveBtn.Location = new Point(160, 186); bakConfigSaveBtn.Name = "bakConfigSaveBtn"; bakConfigSaveBtn.Size = new Size(187, 53); bakConfigSaveBtn.TabIndex = 42; @@ -403,7 +431,7 @@ // // startBakBtn // - startBakBtn.Location = new Point(375, 207); + startBakBtn.Location = new Point(494, 186); startBakBtn.Name = "startBakBtn"; startBakBtn.Size = new Size(213, 53); startBakBtn.TabIndex = 6; @@ -411,27 +439,28 @@ startBakBtn.UseVisualStyleBackColor = true; startBakBtn.Click += startBakBtn_Click; // - // backPublishPath + // backExePath // - backPublishPath.Location = new Point(160, 125); - backPublishPath.Name = "backPublishPath"; - backPublishPath.Size = new Size(431, 23); - backPublishPath.TabIndex = 5; + backExePath.Enabled = false; + backExePath.Location = new Point(160, 125); + backExePath.Name = "backExePath"; + backExePath.Size = new Size(547, 23); + backExePath.TabIndex = 5; // // label5 // label5.AutoSize = true; label5.Location = new Point(61, 125); label5.Name = "label5"; - label5.Size = new Size(92, 17); + label5.Size = new Size(56, 17); label5.TabIndex = 4; - label5.Text = "备份程序根路径"; + label5.Text = "程序路径"; // // bakDbName // bakDbName.Location = new Point(160, 28); bakDbName.Name = "bakDbName"; - bakDbName.Size = new Size(428, 23); + bakDbName.Size = new Size(547, 23); bakDbName.TabIndex = 3; // // label4 @@ -447,7 +476,7 @@ // backPathTBox.Location = new Point(160, 75); backPathTBox.Name = "backPathTBox"; - backPathTBox.Size = new Size(429, 23); + backPathTBox.Size = new Size(547, 23); backPathTBox.TabIndex = 1; // // label3 @@ -465,10 +494,10 @@ groupBox5.Controls.Add(vuePublishBtn); groupBox5.Location = new Point(10, 24); groupBox5.Name = "groupBox5"; - groupBox5.Size = new Size(630, 129); + groupBox5.Size = new Size(798, 129); groupBox5.TabIndex = 41; groupBox5.TabStop = false; - groupBox5.Text = "测试环境重新发布"; + groupBox5.Text = "测试环境基于备份代码重新发布(感觉自动发布未发布成功,重新发布一下)"; // // netCorePublishBtn // @@ -494,11 +523,95 @@ // openFileDialog1.FileName = "openFileDialog1"; // + // label7 + // + label7.AutoSize = true; + label7.Location = new Point(27, 65); + label7.Name = "label7"; + label7.Size = new Size(276, 17); + label7.TabIndex = 44; + label7.Text = "方式一: 前端发布选择html | 后端发布选择压缩包"; + // + // publishFileTBox + // + publishFileTBox.Enabled = false; + publishFileTBox.Location = new Point(14, 98); + publishFileTBox.Name = "publishFileTBox"; + publishFileTBox.Size = new Size(547, 23); + publishFileTBox.TabIndex = 45; + // + // selectPublishFilePathBtn + // + selectPublishFilePathBtn.Location = new Point(606, 94); + selectPublishFilePathBtn.Name = "selectPublishFilePathBtn"; + selectPublishFilePathBtn.Size = new Size(95, 27); + selectPublishFilePathBtn.TabIndex = 46; + selectPublishFilePathBtn.Text = "选择"; + selectPublishFilePathBtn.UseVisualStyleBackColor = true; + selectPublishFilePathBtn.Click += selectPublishFilePathBtn_Click; + // + // sshVuePublishBtn + // + sshVuePublishBtn.Location = new Point(55, 153); + sshVuePublishBtn.Name = "sshVuePublishBtn"; + sshVuePublishBtn.Size = new Size(128, 40); + sshVuePublishBtn.TabIndex = 47; + sshVuePublishBtn.Text = "发布前端"; + sshVuePublishBtn.UseVisualStyleBackColor = true; + sshVuePublishBtn.Click += sshVuePublishBtn_Click; + // + // sshNetCorePublishBtn + // + sshNetCorePublishBtn.Location = new Point(290, 153); + sshNetCorePublishBtn.Name = "sshNetCorePublishBtn"; + sshNetCorePublishBtn.Size = new Size(128, 40); + sshNetCorePublishBtn.TabIndex = 48; + sshNetCorePublishBtn.Text = "发布后端"; + sshNetCorePublishBtn.UseVisualStyleBackColor = true; + sshNetCorePublishBtn.Click += sshNetCorePublishBtn_Click; + // + // publishFolderTBox + // + publishFolderTBox.Enabled = false; + publishFolderTBox.Location = new Point(14, 282); + publishFolderTBox.Name = "publishFolderTBox"; + publishFolderTBox.Size = new Size(547, 23); + publishFolderTBox.TabIndex = 49; + // + // label8 + // + label8.AutoSize = true; + label8.Location = new Point(14, 245); + label8.Name = "label8"; + label8.Size = new Size(360, 17); + label8.TabIndex = 50; + label8.Text = "方式二: 后端发布程序文件夹(自己打成压缩包,上传然后发布)"; + // + // selectPublishFolderPathBtn + // + selectPublishFolderPathBtn.Location = new Point(606, 282); + selectPublishFolderPathBtn.Name = "selectPublishFolderPathBtn"; + selectPublishFolderPathBtn.Size = new Size(95, 27); + selectPublishFolderPathBtn.TabIndex = 51; + selectPublishFolderPathBtn.Text = "选择"; + selectPublishFolderPathBtn.UseVisualStyleBackColor = true; + selectPublishFolderPathBtn.Click += selectPublishFolderPathBtn_Click; + // + // sshNetCorePublishBtn2 + // + sshNetCorePublishBtn2.Location = new Point(290, 341); + sshNetCorePublishBtn2.Name = "sshNetCorePublishBtn2"; + sshNetCorePublishBtn2.Size = new Size(128, 40); + sshNetCorePublishBtn2.TabIndex = 52; + sshNetCorePublishBtn2.Text = "发布后端"; + sshNetCorePublishBtn2.UseVisualStyleBackColor = true; + sshNetCorePublishBtn2.Click += sshNetCorePublishBtn2_Click; + // // PublishForm // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1275, 1074); + ClientSize = new Size(1488, 1094); Controls.Add(groupBox5); Controls.Add(tabControl1); Controls.Add(groupBox3); @@ -516,6 +629,8 @@ groupBox2.PerformLayout(); tabPage2.ResumeLayout(false); tabPage2.PerformLayout(); + groupBox6.ResumeLayout(false); + groupBox6.PerformLayout(); groupBox5.ResumeLayout(false); ResumeLayout(false); } @@ -551,7 +666,7 @@ private TextBox backPathTBox; private Label label3; private TextBox bakDbName; - private TextBox backPublishPath; + private TextBox backExePath; private Label label5; private GroupBox groupBox4; private Button startBakBtn; @@ -563,5 +678,15 @@ private OpenFileDialog openFileDialog1; private Button serviceConfigSaveBtn; private Button bakConfigSaveBtn; + private GroupBox groupBox6; + private TextBox publishFileTBox; + private Label label7; + private Button selectPublishFilePathBtn; + private Button sshNetCorePublishBtn; + private Button sshVuePublishBtn; + private Button selectPublishFolderPathBtn; + private Label label8; + private TextBox publishFolderTBox; + private Button sshNetCorePublishBtn2; } } \ No newline at end of file diff --git a/PublishSite/PublishForm.cs b/PublishSite/PublishForm.cs index f990483a..24ef5daa 100644 --- a/PublishSite/PublishForm.cs +++ b/PublishSite/PublishForm.cs @@ -131,7 +131,7 @@ namespace PublishSite bakDbName.Text = jObjectCofig["BackUp"]["DataBaseName"].ToString(); backPathTBox.Text = jObjectCofig["BackUp"]["BackPath"].ToString(); - backPublishPath.Text = jObjectCofig["BackUp"]["ProgramRootPath"].ToString(); + backExePath.Text = jObjectCofig["DefaultService"]["BinPath"].ToString(); var credentialNode = jObjectCofig["Credential"]; @@ -147,6 +147,7 @@ namespace PublishSite private void serviceConfigSaveBtn_Click(object sender, EventArgs e) { + serviceConfigSaveBtn.Enabled = false; var serviceName = serviceNameTBox.Text; DialogResult dr = MessageBox.Show($"{EnvName}环境服务配置回写 ?", "保存提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); @@ -188,10 +189,13 @@ namespace PublishSite WinformLog("服务配置回写成功!"); } + + serviceConfigSaveBtn.Enabled = true; } private void bakConfigSaveBtn_Click(object sender, EventArgs e) { + bakConfigSaveBtn.Enabled = false; var serviceName = serviceNameTBox.Text; DialogResult dr = MessageBox.Show($"{EnvName}环境备份配置回写 ?", "保存提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); @@ -224,11 +228,11 @@ namespace PublishSite jObjectCofig["BackUp"]["DataBaseName"] = bakDbName.Text.Trim(); jObjectCofig["BackUp"]["BackPath"] = backPathTBox.Text.Trim(); - jObjectCofig["BackUp"]["ProgramRootPath"] = backPublishPath.Text.Trim(); File.WriteAllText(path, jObjectCofig.ToString()); WinformLog("备份配置回写成功!"); + bakConfigSaveBtn.Enabled = true; } } @@ -243,7 +247,8 @@ namespace PublishSite { if (rb_local.Checked) { - + WinformLog("本地环境不支持备份操作,懒得开发"); + return; } else { @@ -257,7 +262,9 @@ namespace PublishSite var dbName = bakDbName.Text.Trim(); var backRootPath = backPathTBox.Text.Trim(); var serviceName = jObjectCofig["DefaultService"]["ServiceName"].ToString().Trim(); - var programFolder = backPublishPath.Text.Trim(); + + var programPath = backExePath.Text.Trim(); + var programFolder = Path.GetDirectoryName(programPath); var dbUser = jObjectCofig["BackUp"]["DBUser"].ToString().Trim(); var dbPwd = jObjectCofig["BackUp"]["DBPwd"].ToString().Trim(); @@ -276,39 +283,39 @@ namespace PublishSite } - ////停止服务 - //WinformLog($"停止后台服务{serviceName}..."); + //停止服务 + WinformLog($"停止后台服务{serviceName}..."); - //var stopServiceCommand = client.CreateCommand($"sc stop \"{serviceName}\""); - //command.Execute(); + var stopServiceCommand = client.CreateCommand($"sc stop \"{serviceName}\""); + stopServiceCommand.Execute(); - //if (command.ExitStatus != 0) - //{ - // throw new Exception($"Failed to stop {serviceName}."); - //} + if (stopServiceCommand.ExitStatus != 0) + { + throw new Exception($"Failed to stop {serviceName}."); + } + Task.Delay(1000); + //备份后端文件 - ////备份后端文件 + WinformLog($"备份后端文件..."); + string archivePath = $"{backupFolderPath}\\NetCore.zip"; + var compressCommand = client.CreateCommand($"powershell.exe Compress-Archive -Path \"{programFolder}\\*.*\" -DestinationPath \"{archivePath}\" -Force"); + compressCommand.Execute(); + if (compressCommand.ExitStatus != 0) + { + throw new Exception("Failed to compress and move folder contents."); + } - //WinformLog($"备份后端文件..."); - //string archivePath = $"{backupFolderPath}\\NetCore.zip"; - //command = client.CreateCommand($"powershell.exe Compress-Archive -Path \"{programFolder}\\*.*\" -DestinationPath \"{archivePath}\" -Force"); - //command.Execute(); - //if (command.ExitStatus != 0) - //{ - // throw new Exception("Failed to compress and move folder contents."); - //} + //启动服务 + WinformLog($"启动后台服务{serviceName}..."); - ////启动服务 - //WinformLog($"停止后台服务{serviceName}..."); + var startServiceCommand = client.CreateCommand($"sc start \"{serviceName}\""); + startServiceCommand.Execute(); - //var startServiceCommand = client.CreateCommand($"sc start \"{serviceName}\""); - //command.Execute(); - - //if (command.ExitStatus != 0) - //{ - // throw new Exception($"Failed to start {serviceName}."); - //} + if (startServiceCommand.ExitStatus != 0) + { + throw new Exception($"Failed to start {serviceName}."); + } //备份数据库 @@ -316,14 +323,14 @@ namespace PublishSite WinformLog($"开始备份数据库{dbName}..."); string databaseBackupPath = $"{backupFolderPath}\\db.bak"; - command = client.CreateCommand($"sqlcmd -S . -U \"{dbUser}\" -P \"{dbPwd}\" -Q \"BACKUP DATABASE [{dbName}] TO DISK='{databaseBackupPath}' WITH INIT\""); - command.Execute(); - if (command.ExitStatus != 0) + var sqlcommand = client.CreateCommand($"sqlcmd -S . -U \"{dbUser}\" -P \"{dbPwd}\" -Q \"BACKUP DATABASE [{dbName}] TO DISK='{databaseBackupPath}' WITH INIT\""); + sqlcommand.Execute(); + if (sqlcommand.ExitStatus != 0) { throw new Exception("Failed to backup database."); } - + WinformLog($"备份操作执行结束..."); } catch (Exception ex) { @@ -639,6 +646,35 @@ namespace PublishSite #endregion + #region 上传文件到远程服务器发布 + + + private void selectPublishFilePathBtn_Click(object sender, EventArgs e) + { + + } + + private void selectPublishFolderPathBtn_Click(object sender, EventArgs e) + { + + } + + private void sshVuePublishBtn_Click(object sender, EventArgs e) + { + + } + + private void sshNetCorePublishBtn_Click(object sender, EventArgs e) + { + + } + + private void sshNetCorePublishBtn2_Click(object sender, EventArgs e) + { + + } + + #endregion diff --git a/PublishSite/appsettings.Development.json b/PublishSite/appsettings.Development.json index b35b0280..d898247d 100644 --- a/PublishSite/appsettings.Development.json +++ b/PublishSite/appsettings.Development.json @@ -2,9 +2,8 @@ "BackUp": { "DataBaseName": "IRaCIS_New_Tet", "DBUser": "sa", - "DBPwd": "123456", + "DBPwd": "dev123456DEV", "BackPath": "D:\\Develop\\PublishSite\\发布备份", - "ProgramRootPath": "D:\\Develop\\PublishSite\\IRaCIS.NetCore.API", "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" }, "Credential": { diff --git a/PublishSite/appsettings.Production.json b/PublishSite/appsettings.Production.json index c7c6ab34..d898247d 100644 --- a/PublishSite/appsettings.Production.json +++ b/PublishSite/appsettings.Production.json @@ -2,9 +2,8 @@ "BackUp": { "DataBaseName": "IRaCIS_New_Tet", "DBUser": "sa", - "DBPwd": "123456", - "BackPath": "Warning", - "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "DBPwd": "dev123456DEV", + "BackPath": "D:\\Develop\\PublishSite\\发布备份", "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" }, "Credential": { diff --git a/PublishSite/appsettings.Verify.json b/PublishSite/appsettings.Verify.json index c7c6ab34..d898247d 100644 --- a/PublishSite/appsettings.Verify.json +++ b/PublishSite/appsettings.Verify.json @@ -2,9 +2,8 @@ "BackUp": { "DataBaseName": "IRaCIS_New_Tet", "DBUser": "sa", - "DBPwd": "123456", - "BackPath": "Warning", - "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "DBPwd": "dev123456DEV", + "BackPath": "D:\\Develop\\PublishSite\\发布备份", "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" }, "Credential": { diff --git a/PublishSite/appsettings.local.json b/PublishSite/appsettings.local.json index c7c6ab34..d898247d 100644 --- a/PublishSite/appsettings.local.json +++ b/PublishSite/appsettings.local.json @@ -2,9 +2,8 @@ "BackUp": { "DataBaseName": "IRaCIS_New_Tet", "DBUser": "sa", - "DBPwd": "123456", - "BackPath": "Warning", - "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "DBPwd": "dev123456DEV", + "BackPath": "D:\\Develop\\PublishSite\\发布备份", "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" }, "Credential": {