From 02a4fdd78cef9c7d2a26bfb9aa187179cf0baac3 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 25 二月 2026 17:44:26 +0800
Subject: [PATCH] 1
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
index b1dba4c..66084e4 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
@@ -13,6 +13,7 @@
using WIDESEAWCS_Core.Extensions;
using WIDESEAWCS_Core.Filter;
using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_Core.Middlewares;
using WIDESEAWCS_QuartzJob.QuartzExtensions;
using WIDESEAWCS_QuartzJob.Seed;
@@ -22,6 +23,40 @@
var builder = WebApplication.CreateBuilder(args);
+int workerThreads = Environment.ProcessorCount * 8;
+int completionThreads = Environment.ProcessorCount;
+ThreadPool.SetMaxThreads(workerThreads, completionThreads);
+
+AppDomain.CurrentDomain.FirstChanceException += (sender, e) =>
+{
+ bool flag = e.Exception.TargetSite?.DeclaringType?.Namespace?.StartsWith("WIDESEA") == true;
+
+ if (e.Exception is not OperationCanceledException && flag)
+ {
+ string folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Log\\Exception");
+ Exception ex = e.Exception;
+ StringBuilder builder = new StringBuilder();
+ builder.Append("错误信息:");
+ builder.Append(ex.Message);
+ builder.Append(Environment.NewLine);
+ builder.Append("错误源:");
+ builder.Append(ex.Source);
+ builder.Append(Environment.NewLine);
+ builder.Append("错误堆栈:");
+ builder.Append(ex.StackTrace);
+ builder.Append(Environment.NewLine);
+ builder.Append("错误类型:");
+ builder.Append(ex.GetType().ToString());
+ builder.Append(Environment.NewLine);
+ builder.Append("错误方法:");
+ builder.Append(ex.TargetSite?.ToString());
+ builder.Append(Environment.NewLine);
+ builder.Append(Environment.NewLine);
+
+ QuartzLogger.WriteLogToFile($"Error_全局错误", builder.ToString());
+ }
+};
+
if (!HslCommunication.Authorization.SetAuthorizationCode("95f1611d-633c-46ea-b03a-38ede1629f74"))
{
ConsoleHelper.WriteErrorLine("授权失败!当前程序只能使用24小时!");
--
Gitblit v1.9.3