![](/img/trans.png)
[英]TypeLoadException in Microsoft.AspNetCore.Server.Kestrel on startup for .NET Core 1.1 project
[英]Microsoft.AspNetCore.Server.Kestrel[0] Unable to start Kestrel
當我運行我的圖像 docker 他給我這個錯誤
Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
System.InvalidOperationException: HTTPS endpoints can only be configured using KestrelServerOptions.Listen().
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAddressAsync(String address, AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, List`1 listenOptions, ILogger logger, Func`2 createBinding)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
Unhandled Exception: System.InvalidOperationException: HTTPS endpoints can only be configured using KestrelServerOptions.Listen().
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAddressAsync(String address, AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, List`1 listenOptions, ILogger logger, Func`2 createBinding)
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 Btorport.Web.Program.Main(String[] args) in /App/Btorport.Web/Program.cs:line 13
我認為證書有問題,所以我刪除並在我的項目中通過執行此命令從新添加->
dotnet dev-certs https --clean
dotnet dev-certs https
dotnet dev-certs https --trust
但是我沒有在我的項目中使用 kestrul 我不知道為什么給我這個錯誤?
&這是我的 BuildWebHost 方法
return WebHost.CreateDefaultBuilder(args)
.UseUrls("http://*:5050;https://*:5050")
.UseStartup<Startup>()
.Build();
您指定它應該為 http 和 https 使用端口 5050。 那是不可能的。 它需要是不同的端口。
例如
return WebHost.CreateDefaultBuilder(args)
.UseUrls("http://*:5050;https://*:5051")
.UseStartup<Startup>()
.Build();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.