fix: 不在代码中绑定url

IIS托管时,代码中指定 Urls 将导致无法启动错误

```csharp
//app.Urls.Clear();
//app.Urls.Add("http://0.0.0.0:6819");
```
无代理时使用 .\LocalServer.exe --urls="http://0.0.0.0:6818" 绑定 固定url
This commit is contained in:
ZhaoLei 2024-10-17 15:24:30 +08:00
parent 8a36def339
commit 4a5bc24579
2 changed files with 8 additions and 5 deletions

View file

@ -37,14 +37,16 @@ if (app.Environment.IsDevelopment())
app.UseSwaggerUI();
}
DefaultFilesOptions defops = new DefaultFilesOptions();
defops.DefaultFileNames.Clear();
//defops.DefaultFileNames.Clear();
defops.DefaultFileNames.Add("index.html");
app.UseDefaultFiles(defops);
app.UseStaticFiles();
app.UseWebSockets();
app.UseAuthorization();
app.Urls.Clear();
app.Urls.Add("http://0.0.0.0:6818");
//app.Urls.Clear();
//app.Urls.Add("http://0.0.0.0:6818");
app.MapControllers();
app.Run();

View file

@ -40,7 +40,8 @@ if (app.Environment.IsDevelopment())
app.UseSwaggerUI();
}
app.UseWebSockets();
app.Urls.Clear();
app.Urls.Add("http://0.0.0.0:6819");
//app.Urls.Clear();
//app.Urls.Add("http://0.0.0.0:6819");
app.MapControllers();
app.Run();