tuguangyao123 2021-12-21 11:09 采纳率: 0%
浏览 150

vs2022 创建API 启动后SwaggerUI一片空白,且报错

昨天装机Win10系统,更换开发工具版本,新上VS2022,安装无问题,随后创建API,启动发现net6 在API这里自带Swagger,但看视频别人的都能成功,本机却不能,去掉swagger接口数据返回正常json,使用swagger就报错未找到。

img

  • 写回答

1条回答 默认 最新

  • CSDN专家-showbo 2021-12-21 11:46
    关注

    I hope this is not too late to post. But I had the same issue and found a solution to it:

    1. Check if all your controller methods have [http] tag. If they all do and still doesn't work go to step 2
    2. In your configure function ensure that you have app.UseStaticFiles(); If it still doesn't work go to step 3
    3. Uninstall and reinstall swagger. If it doesn't work go to step 4 (Core Only)
    4. If you are using Core Install Microsoft.AspNetCore.StaticFiles and reference it in your project.
      That is as far as I got and mine started working
      题主参考下:
      应该是资源路径加载有问题
    评论

报告相同问题?

问题事件

  • 创建了问题 12月21日

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?