我正在运行一个ASP。NET Core 8.0 Web Service应用程序。在我的Windows电脑上,我开发了这个应用程序,并将其发布到arm64,然后将其复制到目标电脑(树莓派)。尽管每个配置文件都要求应用程序托管在端口上
11111
(我想要的),当我在目标计算机上启动应用程序时,会发生以下情况:
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'http://*.11111'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
Hosting failed to start
System.IO.IOException: Failed to bind to address http://[::]:80: address already in use.
我已经尝试了所有有多重冗余的方法,但似乎无法在11111上主持。
appsettings.json:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"urls": "http://*.11111;http://192.168.1.169:11111;http://localhost:11111;http://<MYDOMAIN>:11111;http://*:11111"
}
程序.cs:
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
Constants.LoadConstants();
builder.WebHost.UseUrls(new string[]
{
"http://*.11111",
"http://192.168.1.169:11111",
"http://<MYDOMAIN>:11111",
"http://0.0.0.0:11111",
"http://*:11111"
});
builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.PropertyNamingPolicy = null;
});
var app = builder.Build();
// Configure the HTTP request pipeline.
app.Urls.Add("http://*.11111");
app.MapControllers();
app.Run();
整个应用程序中根本没有提到“80”这个名字。非常感谢您的帮助。