fix: 修复空 catch 吞异常问题,端口号抽离到配置,统一日志为 Serilog

- 所有空 catch 块补全日志记录,统一使用 Serilog/AppLog
- 按场景分级:Error(意外失败)、Warning(次要问题)、Information(预期内)
- 端口 HttpPort/HttpsPort 抽离到 appsettings.json Server 配置节
- QrCodeService 通过 IConfiguration 读取端口,消除硬编码
- 前端通过 Vite proxy 转发 /api,http.ts 统一使用 origin 地址
- 移除所有 Debug.WriteLine 和 Serilog.Log.Debug 日志

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 15:17:59 +08:00
co-authored by Claude Opus 4.7
parent d93098638d
commit 6acc92ca27
10 changed files with 44 additions and 21 deletions
@@ -223,9 +223,9 @@ namespace FileShare_Services.Services.FileLibrary
{
await ScanRootAsync(root.Id, cancellationToken);
}
catch
catch (Exception ex)
{
// ScanRootAsync records the error on the root. Continue scanning other roots.
Serilog.Log.Warning(ex, "扫描文件库根目录失败 RootId={RootId}", root.Id);
}
}
}
@@ -378,8 +378,9 @@ namespace FileShare_Services.Services.FileLibrary
directories = Directory.EnumerateDirectories(current);
files = Directory.EnumerateFiles(current);
}
catch
catch (Exception ex)
{
Serilog.Log.Information(ex, "无法枚举目录 {Directory},已跳过", current);
continue;
}
@@ -460,8 +461,9 @@ namespace FileShare_Services.Services.FileLibrary
{
return drive.IsReady ? selector(drive) : null;
}
catch
catch (Exception ex)
{
Serilog.Log.Information(ex, "获取驱动器属性失败,已跳过");
return null;
}
}