swagger - 除登录外的所有 API 上的 Swagger 401
问题描述
我可以登录 Swagger(出于某种原因,我必须先为访问令牌输入虚假文本)并成功取回访问令牌。但是,当我使用此访问令牌发布到任何其他 Api 时,我总是返回错误 401
这曾经有效,所以我不知道是我们升级到 .Net 5 的原因还是其他原因。
这是我们为 launchSettings.json 提供的内容:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
}
},
"MyApp": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
}
}
}
}
我们正在使用 6.1 版的 Swashbuckle
解决方案
推荐阅读
- html - 我想自定义 react-select
- python - Python输入变量逗号分隔,for循环
- python - 在python中计算两个概率之间的pdf
- python - 通过对另一列的某些操作对基于组的 Pandas 数据框进行排序
- sql - 如何在sql中仅显示2个表中的当前有效数据
- css - 为什么对同一个选择器使用两种不同的规则?
- sharepoint-online - PowerAutomate:将 Sharepoint 列表导出为 CSV(格式标题和多项选择)
- editor - IDE 中快捷方式冲突的可能原因是什么?
- javascript - 构造函数调用在javascript中返回值的成员函数
- python - Flask 应用程序在本地运行良好,但在 Heroku 上部署时显示错误