首页 新闻 会员 周边 捐助

ASP.NET Core 应用启动时报错:"Aborted (core dumped)"

0
悬赏园豆:30 [已解决问题] 解决于 2020-02-21 19:58

一个 asp.net core 应用在启动时失败退出,报错信息如下:

at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Cnblogs.WebAPI.Program.Main(String[] args) in /src/Cnblogs.WebAPI/Program.cs:line 12
Aborted (core dumped)

Program.cs 中对应的第12号代码是

CreateHostBuilder(args).Build().Run();

请问如何解决这个问题?

dudu的主页 dudu | 高人七级 | 园豆:30939
提问于:2020-02-21 17:27
< >
分享
最佳答案
0

Startup.ConfigureServices 中重复注册 HttpClient 的代码引起的,对同样的类型执行了2次 services.AddHttpClient

dudu | 高人七级 |园豆:30939 | 2020-02-21 19:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册