|
@@ -345,30 +345,26 @@ namespace XdCxRhDW
|
|
|
|
|
|
private void StartProcess()
|
|
|
{
|
|
|
- Task.Run(() =>
|
|
|
+ KillProcess();
|
|
|
+ Process pro = new Process();
|
|
|
+ var servicesDir = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Service\\"), "*", SearchOption.TopDirectoryOnly);
|
|
|
+ foreach (var item in servicesDir)
|
|
|
{
|
|
|
- KillProcess();
|
|
|
- Process pro = new Process();
|
|
|
- var servicesDir = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Service\\"), "*", SearchOption.TopDirectoryOnly);
|
|
|
- Parallel.ForEach(servicesDir, item =>
|
|
|
+ try
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- string exeName = Path.GetFileNameWithoutExtension(item);
|
|
|
- string exeFile = $"{item}\\{exeName}.exe";
|
|
|
- pro.StartInfo.FileName = exeFile;
|
|
|
- pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
|
|
- pro.StartInfo.Arguments = $"http://127.0.0.1:{SysConfig.Config.HttpPort}";
|
|
|
- pro.Start();
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- Serilog.Log.Error(ex, $"启动【{item}】中的服务异常");
|
|
|
- DxHelper.MsgBoxHelper.ShowError($"启动【{item}】中的服务异常");
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
+ string exeName = Path.GetFileNameWithoutExtension(item);
|
|
|
+ string exeFile = $"{item}\\{exeName}.exe";
|
|
|
+ pro.StartInfo.FileName = exeFile;
|
|
|
+ pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
|
|
+ pro.StartInfo.Arguments = $"http://127.0.0.1:{SysConfig.Config.HttpPort}";
|
|
|
+ pro.Start();
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error(ex, $"启动【{item}】中的服务异常");
|
|
|
+ DxHelper.MsgBoxHelper.ShowError($"启动【{item}】中的服务异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
private void KillProcess()
|
|
|
{
|