在WebAPI .NET 4.8 HTTP错误403.14中使用Swashbuckle 5.6.0-禁止

发布于 2025-02-12 01:03:52 字数 714 浏览 1 评论 0原文

我在现有的.NET 4.8 WebAPI上实施Swagger时遇到了一些麻烦。

使用VS2019,我使用Nuget软件包管理器安装了SwashBuckle 5.6.0,它已将SwaggerConfig.cs添加到App_start文件夹中。我已经离开了这个文件库存标准。

在线示例似乎意味着现在应该运行。我正在本地进行调试。我启动服务,默认情况下,该服务转到http:// localhost:53374/aget2.aspx。到达那里后,我将URL更改为http:// localhost:53374/swagger/

当我收到以下错误时:

HTTP错误403.14-禁止Web服务器配置为未列出此目录的内容。

尝试的事情:

  • 删除.vs文件夹
  • 在根下面检查一个摇摇欲坠的文件夹,结果:没有
  • 尝试将URL更改为:http:// localhost:53374/swagger/swagger/ui/index < /code>,没有运气,

我没有启用目录浏览,因为我不认为这就是需要的,因为我用Swagger测试了一个简单的核心API项目,并且没有此功能。

我还能尝试什么?任何想法都是最欢迎的。

可能是Swagger需要某种类型的授权吗?

I'm having a little trouble implementing Swagger on an existing .NET 4.8 WebApi.

Using VS2019 I have used Nuget Package Manager to install Swashbuckle 5.6.0, it has added SwaggerConfig.cs into the App_Start folder. I have left this file stock-standard.

Online examples seem to imply that it should now run. I am running it locally in debug. I start the service, which by default goes to http://localhost:53374/about2.aspx. Once there I alter the URL to http://localhost:53374/swagger/.

That when I get the following error:

HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.

Things tried:

  • deleting the .vs folder
  • checking for a Swagger folder under the root, result: nothing
  • tried altering the URL to: http://localhost:53374/swagger/ui/index, no luck

I haven't enabled directory browsing as I don't think that is what this needs, as I tested a simple core API project with Swagger and it worked without this.

What else could I try? Any ideas are most welcome.

Could it be that Swagger needs some type of authorization?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文