无法启动红隼。 System.FormatException: 无效 URL: 'http:////*:80'

Unable to start Kestrel. System.FormatException: Invalid URL: 'http:////*:80'

我在发布应用程序后无法启动 dotnet 核心应用程序。 dotnet run 在开发环境中启动应用程序时,尝试在发布后启动应用程序只会引发此错误。

crit: Microsoft.AspNetCore.Server.Kestrel[0]
  Unable to start Kestrel.
System.FormatException: Invalid URL: 'http:////*:80'.
at Microsoft.AspNetCore.Server.Kestrel.Core.ServerAddress.FromUrl(String url)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.ParseAddress(String address, Boolean& https)
at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.ValidateOptions()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)

Unhandled Exception: System.FormatException: Invalid URL: 'http:////*:80'.
at Microsoft.AspNetCore.Server.Kestrel.Core.ServerAddress.FromUrl(String url)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.ParseAddress(String address, Boolean& https)
at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.ValidateOptions()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at NiqVive.Api.Program.Main(String[] args) in /home/sav/github/nForTics/NiqVive/NiqVive.Api/Program.cs:line 12
[1]    29044 abort (core dumped)  dotnet NiqVive.Api.dll

这是我的Program.cs

namespace NiqVive.Api
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .UseKestrel(options =>
                    {                    
                        options.Listen(IPAddress.Any, 5007);
                        options.Limits.MaxRequestBodySize = null;
                    })

                .UseDefaultServiceProvider(options => {
                    options.ValidateScopes = false;
                });

    }
}

--硬件 版本:2.1.401

运行时环境: OS 姓名:ubuntu OS版本:18.04 RID:ubuntu.18.04-x64 基本路径:/usr/share/dotnet/sdk/2.1.401/

如果我发布应用程序,它不会启动。

转到属性文件夹并打开 launchSetting.json 文件更改端口号与其他一些 在 "applicationUrl": "http://localhost:5001;http://localhost:4000", here we have http://localhost:5000 将其更改为另一个端口