undefined /swagger/v1/swagger.json
时间: 2023-08-18 20:10:29 浏览: 221
undefined /swagger/v1/swagger.json是一个URL地址,用于获取Swagger JSON文件。根据引用和引用的信息,问题出现的原因是在应用程序的Configure方法中没有正确配置Swagger。要解决这个问题,需要在Configure方法中添加以下代码:
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
这些代码会启用Swagger中间件服务,并指定Swagger JSON的终结点。通过访问https://localhost:[port]/swagger/v1/swagger.json,你应该能够成功获取Swagger JSON文件。 [1 [2<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [swagger在VS2019 .net core2.2中的使用,及报错undefined /swagger/v1/swagger.json的解决办法](https://blog.csdn.net/qq_28218253/article/details/102496212)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *3* [swagger-lint-api:Swagger JSON API 规范的 Linter](https://download.csdn.net/download/weixin_42112658/19252001)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文