码迷,mamicode.com
首页 > Windows程序 > 详细

[Swagger]Unable to resolve service for type 'Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionGroupCollectionProvider' while attempting to activate

时间:2021-04-13 12:19:16      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:figure   cti   ice   services   transient   with   netcore   load   cep   

详细错误如下

===================

System.AggregateException:“Some services are not able to be constructed (Error while validating the service descriptor ‘ServiceType: Swashbuckle.AspNetCore.Swagger.ISwaggerProvider Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator‘: Unable to resolve service for type ‘Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionGroupCollectionProvider‘ while attempting to activate ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator‘.) (Error while validating the service descriptor ‘ServiceType: Microsoft.Extensions.ApiDescriptions.IDocumentProvider Lifetime: Singleton ImplementationType: Microsoft.Extensions.ApiDescriptions.DocumentProvider‘: Unable to resolve service for type ‘Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionGroupCollectionProvider‘ while attempting to activate ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator‘.)”

环境

===================

环境NetCore5.0

VS:2019

 

解决方案

==========================

参考:https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-5.0&tabs=visual-studio

需要在ConfigureServices添加 services.AddMvc();

技术图片

 

[Swagger]Unable to resolve service for type 'Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionGroupCollectionProvider' while attempting to activate

标签:figure   cti   ice   services   transient   with   netcore   load   cep   

原文地址:https://www.cnblogs.com/jerry-li-352/p/14649409.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!