第一阶段迁移已完成。

已实现:
ASP.NET Core 10 分层解决方案:[Eis.slnx](C:/Users/BI/Documents/EIS-dotnet/Eis.slnx)
ASP.NET Core 统一入口与健康检查:[Program.cs](C:/Users/BI/Documents/EIS-dotnet/src/Eis.Web/Program.cs)
原前端静态资源无修改托管
未迁移 API 自动转发至旧 Node 服务,兼容 JSON、Cookie、请求体和文件下载
可重复执行的端到端测试:[smoke-dotnet-migration.ps1](C:/Users/BI/Documents/EIS-dotnet/scripts/smoke-dotnet-migration.ps1)
迁移进度与运行说明:[MIGRATION.md](C:/Users/BI/Documents/EIS-dotnet/MIGRATION.md)
验证结果:
This commit is contained in:
2026-07-22 18:45:54 +08:00 Unverified
parent ecb3dc63ed
commit 241fa8a6d7
20 changed files with 680 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
# ASP.NET Core 10 迁移
迁移采用兼容优先的渐进式方案:ASP.NET Core 作为统一入口,尚未迁移的 `/api/*` 请求暂时转发给运行在 `4174` 端口的 Node.js 服务。每完成一个功能域,就在 ASP.NET Core 中注册对应原生端点并停止转发该路径。
## 当前阶段
- [x] ASP.NET Core 10 解决方案与分层项目
- [x] 原前端静态资源无修改托管
- [x] 旧 API 兼容转发,包含 Cookie、请求体、文件下载和状态码
- [x] 存活与迁移就绪检查
- [ ] 公开接口与数据库读取
- [ ] 登录、Session 与 TOTP
- [ ] 考生业务
- [ ] 管理后台、审批流和考务编排
- [ ] 招生录取
- [ ] Excel、文书和缓存
- [ ] 容器入口切换及 Node.js 后端移除
## 本地运行
先在一个终端运行旧 API
```powershell
$env:PORT = '4174'
npm start
```
再在另一个终端运行 ASP.NET Core 入口:
```powershell
dotnet run --project .\src\Eis.Web\Eis.Web.csproj
```
浏览器仍访问 <http://127.0.0.1:4173>。
- `GET /health/live`:只检查 ASP.NET Core 宿主。
- `GET /health/migration`:检查迁移宿主和旧 API 转发链路。
可通过配置 `LegacyNode:Enabled=false` 禁用兼容转发;此时尚未迁移的 API 会返回 `501`
完整的宿主、静态资源、JSON 转发和 Session Cookie 冒烟测试:
```powershell
pwsh.exe -NoLogo -NoProfile -NonInteractive -File .\scripts\smoke-dotnet-migration.ps1
```