Swagger配置报错的原因

这篇具有很好参考价值的文章主要介绍了Swagger配置报错的原因。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

An error occurred while starting the application.
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’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.) (Error while validating the service descriptor ‘ServiceType: Microsoft.Extensions.ApiDescriptions.IDocumentProvider Lifetime: Singleton ImplementationType: Microsoft.Extensions.ApiDescriptions.DocumentProvider’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.) (Error while validating the service descriptor ‘ServiceType: Swashbuckle.AspNetCore.Swagger.ISwaggerProvider Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.)
Microsoft.Extensions.DependencyInjection.ServiceProvider…ctor(IEnumerable serviceDescriptors, ServiceProviderOptions options)

InvalidOperationException: Error while validating the service descriptor ‘ServiceType: Swashbuckle.AspNetCore.Swagger.ISwaggerProvider Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)

InvalidOperationException: Error while validating the service descriptor ‘ServiceType: Microsoft.Extensions.ApiDescriptions.IDocumentProvider Lifetime: Singleton ImplementationType: Microsoft.Extensions.ApiDescriptions.DocumentProvider’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)

InvalidOperationException: Error while validating the service descriptor ‘ServiceType: Swashbuckle.AspNetCore.Swagger.ISwaggerProvider Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)

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’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.) (Error while validating the service descriptor ‘ServiceType: Microsoft.Extensions.ApiDescriptions.IDocumentProvider Lifetime: Singleton ImplementationType: Microsoft.Extensions.ApiDescriptions.DocumentProvider’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.) (Error while validating the service descriptor ‘ServiceType: Swashbuckle.AspNetCore.Swagger.ISwaggerProvider Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’: No constructor for type ‘Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator’ can be instantiated using services from the service container and default values.)
Microsoft.Extensions.DependencyInjection.ServiceProvider…ctor(IEnumerable serviceDescriptors, ServiceProviderOptions options)
Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter.CreateServiceProvider(object containerBuilder)
Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
Microsoft.Extensions.Hosting.HostBuilder.Build()
Swagger.Program.Main(string[] args) in Program.cs
1.以.net3.0为基础环境,安装的swagger版本须为5.0.0.0-rc4
Swagger配置报错的原因,WebCore,microsoft,.net,windows,.netcore2.在startup中进行如下配置
引用OpenAI,并注册、启用
Swagger配置报错的原因,WebCore,microsoft,.net,windows,.netcore

Swagger配置报错的原因,WebCore,microsoft,.net,windows,.netcore记得检查下这里是否为,否则就会犯和我一样的错误。
Swagger配置报错的原因,WebCore,microsoft,.net,windows,.netcore

我的报错的原因是因为使用的模板是COREWEB应用,应当选择CoreWebAPI
Swagger配置报错的原因,WebCore,microsoft,.net,windows,.netcore文章来源地址https://www.toymoban.com/news/detail-693205.html

到了这里,关于Swagger配置报错的原因的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Unsupported Git Version报错的解决方法(windows)

            这是由于版本不适引发的报错:         解决方法也很简单只要将它升级一下就好了(点开idea下面的Terminal):    输入:git --version    查看当前git的版本。     输入:git --update     进行版本升级,选择y。 升级下载完后一直next就好。

    2024年02月05日
    浏览(38)
  • GET http://localhost:8080/xx/xx 404 (Not Found) 和Uncaught (in promise) Error: failed报错的原因

    这两天,我遇见了一个很离谱的错误,我找不到原因发生在哪里,但是知道代理服务器出错了,代理了后端给的接口,但是,却向本地发起请求,快把我整崩溃了 GET http://localhost:8080/xx/xx 404 (Not Found) 和Uncaught (in promise) Error: failed 开启代理后,发起请求,因为后端给的路径没有

    2024年02月07日
    浏览(33)
  • .NET Core WebAPI中封装Swagger配置

    创建一个Utility/SwaggerExt文件夹,添加一个类 在SwaggerExt类中添加方法,将相关配置添写入 调用封装的方法

    2024年02月20日
    浏览(31)
  • 解决在windows下编写shell脚本执行报错的问题

    有时候,我们为了方便,于是在windows下编写shell脚本,编写完成以后放到Linux开发环境中去执行,在执行的时候报如下的错: bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory 两种解决方法: 方法一 第一步:使用下述命令看看该文件的格式,dos格式的文件行尾为^M$,

    2024年02月15日
    浏览(37)
  • Windows系统显示语言的修改及“我们无法获取此Windows显示语言”报错的处理

      本文介绍在 Windows 10 操作系统中,修改系统的显示语言的方法;并解决在这一过程中,出现的“ 很抱歉,我们无法获取此Windows显示语言 ”报错问题。   本文就以将原本系统语言的 中文修改为英文 为例,介绍具体的方法。首先,我们在电脑左下角的开始菜单处,右键

    2024年02月12日
    浏览(21)
  • git push 出现fatal: unable to access…not resolve host:…报错的多方面原因及解决方法 Merge branch 'master' of ...

    在git push -u origin \\\"master\\\"出现以下报错 fatal: unable to access  https://gitee.com.…….git/ : Could not resolve host: gitee.com.…… 在网上查阅、试了各种办法,都解决不了,最后发现自己有如下一些错误,也不知道哪一个导致了这样的结果,但是都更改后成功提交了。 1、我发现我刚注册的账

    2024年02月16日
    浏览(45)
  • 【.net core】获取或排除指定控制器的 Swagger 文档配置

    在api接口开发完成后,我们经常会使用swagger文档配置来查看相关接口信息,有时候也会查看指定某个控制器来生成swagger文档,或是排除某些控制器等操作,如下为示例

    2024年02月12日
    浏览(34)
  • .net8系列-04图文并茂手把手教你配置Swagger支持token以及实现Swagger扩展,Swagger代码单独抽离

    接上篇文章,我们当前已完成如下内容: 创建应用成功 创建接口成功 配置Swagger实现接口注释和版本控制 本文章主要内容为: 配置Swagger支持token传值测试接口 添加如下代码 文件目录:xiaojinWebApplicationxiaojinWebApplicationProgram.cs 打开接口测试页面 配置Token 观察页面 我们发现

    2024年04月27日
    浏览(27)
  • 开机后Microsoft.Net Framework窗口报错

    如下图所示 解决方法 (1)找到控制面板-程序-启用与关闭windows功能 (3)将.NET Framework前面的方框去掉,点击确定,完成重启。 (4)重启后,相同操作,将.NET Framework前面的 方框勾选上 ,点击确定,并在新弹出窗口选择“让Windows更新为你下载文件” 注: 此步骤需要联网,进行

    2024年02月11日
    浏览(33)
  • 启动spring boot项目时加载配置文件报错的问题

    最近把电脑重置了一下,然后重新安装各种开发软件,从gitee拉项目到本地运行时居然启动报错了: Failed to load property source from \\\'file:/D:/program/IdeaProjects/layui/target/classes/application.yml\\\' 这是加载配置文件的时候失败了,提示一堆错误信息,但是没有任何实质性的帮助。 导致种情况

    2024年02月11日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包