Skip to content

Commit e9337dd

Browse files
committed
chore: debug 的时候设置端口
1 parent 139ce86 commit e9337dd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎ChuChartManager/Properties/launchSettings.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"profiles": {
33
"ChuChartManager": {
44
"commandName": "Project",
5-
"launchBrowser": false
5+
"launchBrowser": false,
6+
"applicationUrl": "http://localhost:5000",
7+
"environmentVariables": {
8+
"ASPNETCORE_ENVIRONMENT": "Development"
9+
}
610
}
711
}
812
}

‎ChuChartManager/ServerManager.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public static void StartApp(bool export = false, Action<string>? onStart = null)
6464
builder.WebHost.ConfigureKestrel(serverOptions =>
6565
{
6666
serverOptions.Limits.MaxRequestBodySize = null;
67-
serverOptions.Listen(IPAddress.Loopback, 0);
67+
if (!builder.Environment.IsDevelopment())
68+
serverOptions.Listen(IPAddress.Loopback, 0);
6869
#if !DEBUG
6970
if (export)
7071
{

0 commit comments

Comments
 (0)