当我在 Visual Studio 2019 中创建新的 .NET 5 项目时出现此异常。
IOException:IDX20807:无法从以下位置检索文档:
'系统.字符串'。 Http响应消息:
'System.Net.Http.HttpResponseMessage',HttpResponseMessage.Content:
'系统.字符串'。
Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(字符串
地址、CancellationToken 取消)
Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(字符串
地址、IDocumentRetriever 检索器、CancellationToken 取消)
Microsoft.IdentityModel.Protocols.ConfigurationManager.GetConfigurationAsync(CancellationToken
取消)
在启动应用程序之前,我收到此错误:
所需组件 -dotnet msidentity tool
您可以在“连接服务 - 服务依赖项”中修复此问题,并按“配置”设置 Microsoft 标识平台。
对我来说,它像这样被卡住了,但什么也没发生:
In appsettings.json
然后我找到了以下代码:
/*
The following identity settings need to be configured
before the project can be successfully executed.
For more info see https://aka.ms/dotnet-template-ms-identity-platform
*/
Visited https://aka.ms/dotnet-template-ms-identity-platform https://aka.ms/dotnet-template-ms-identity-platform并使用了该工具msidentity-app-sync
反而。首先安装它,然后验证我是否安装了该工具。
dotnet tool install -g msidentity-app-sync
dotnet tool list -g
然后跑了msidentity-app-sync
在项目文件夹中。一个新的App registrations
将创建于Azure Active Directory
该项目现在可以运行了。
如果您想使用现有的应用程序,您还可以自己指定租户和客户,如下所示:
msidentity-app-sync --tenant-id <tenant-id> --username <username> --client-id <client-id>