From c66a36aa72655391510ec9eac6ab6ff5782eadac Mon Sep 17 00:00:00 2001 From: "821644@qq.com" <821644@qq.com> Date: Mon, 13 Apr 2026 20:20:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=81=E5=B9=B3=E5=8C=96?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E9=83=A8=E7=BD=B2=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=89=8D=E7=AB=AFbase=E8=B7=AF=E5=BE=84=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0deploy.ps1=E4=B8=BAAPI=E6=A0=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.ps1 | 30 ++++++++++++--------------- src/frontend/admin/vite.config.ts | 1 + src/frontend/dashboard/vite.config.ts | 1 + 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/deploy.ps1 b/deploy.ps1 index a6cfd79..04e8f60 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -41,8 +41,8 @@ $ApiProject = Join-Path $ProjectRoot "Haoliang.Api\Haoliang.Api.csproj" $AdminProject = Join-Path $ProjectRoot "src\frontend\admin" $DashboardProject = Join-Path $ProjectRoot "src\frontend\dashboard" -# 部署配置 -$ApiDir = Join-Path $PublishDir "api" +# 部署配置(扁平化目录:API在根目录,admin和dashboard为子目录) +$ApiDir = $PublishDir $AdminDir = Join-Path $PublishDir "admin" $DashboardDir = Join-Path $PublishDir "dashboard" @@ -380,19 +380,15 @@ mysql -u haoliang -p cnc_log < cnc_log_fixed.sql - .NET CLR 版本: **无托管代码** - 托管管道模式: **集成** 3. 创建网站 `Haoliang` - - 物理路径: `D:\wwwroot\haoliang\api` + - 物理路径: `D:\wwwroot\haoliang` - 端口: 5000 -4. 创建子应用 - - `admin` -> `D:\wwwroot\haoliang\admin` - - `dashboard` -> `D:\wwwroot\haoliang\dashboard` + - 不需要创建子应用,admin 和 dashboard 是文件目录 ### 4. 防火墙配置 ```powershell # 开放端口 New-NetFirewallRule -DisplayName "Haoliang API" -Direction Inbound -Protocol TCP -LocalPort 5000 -Action Allow -New-NetFirewallRule -DisplayName "Haoliang Admin" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow -New-NetFirewallRule -DisplayName "Haoliang Dashboard" -Direction Inbound -Protocol TCP -LocalPort 8081 -Action Allow ``` ## 访问地址 @@ -407,14 +403,14 @@ New-NetFirewallRule -DisplayName "Haoliang Dashboard" -Direction Inbound -Protoc ## 目录结构 \`\`\` -wwwroot/ -├── api/ # 后端 API -│ ├── Haoliang.Api.exe # 主程序 -│ ├── appsettings.json # 开发配置 -│ ├── appsettings.Production.json # 生产配置 ← 修改这个 -│ ├── web.config # IIS 配置 -│ ├── logs/ # 日志目录 -│ └── data/ # 数据目录 +wwwroot/ # 网站根目录 ← IIS网站直接指向这里 +├── Haoliang.Api.exe # 后端主程序 +├── Haoliang.Api.dll +├── appsettings.json # 开发配置 +├── appsettings.Production.json # 生产配置 ← 修改这个 +├── web.config # IIS 配置 +├── logs/ # 日志目录 +├── data/ # 数据目录 ├── admin/ # 管理后台 │ ├── index.html │ └── assets/ @@ -425,7 +421,7 @@ wwwroot/ ## 故障排查 -查看日志: `api\logs\stdout_*.log` +查看日志: `logs\stdout_*.log` "@ $readmePath = Join-Path $PublishDir "部署说明.md" diff --git a/src/frontend/admin/vite.config.ts b/src/frontend/admin/vite.config.ts index ed5f460..d71e505 100644 --- a/src/frontend/admin/vite.config.ts +++ b/src/frontend/admin/vite.config.ts @@ -4,6 +4,7 @@ import path from 'path' export default defineConfig({ plugins: [vue()], + base: '/admin/', resolve: { alias: { '@': path.resolve(__dirname, './src') diff --git a/src/frontend/dashboard/vite.config.ts b/src/frontend/dashboard/vite.config.ts index ab5991f..d4beff4 100644 --- a/src/frontend/dashboard/vite.config.ts +++ b/src/frontend/dashboard/vite.config.ts @@ -4,6 +4,7 @@ import path from 'path' export default defineConfig({ plugins: [vue()], + base: '/dashboard/', resolve: { alias: { '@': path.resolve(__dirname, './src')