首页 > 解决方案 > 安装 Identity Server 4 模板

问题描述

我是一名 Identity Server 4 新手,试图遵循 Identity Server 4 文档。按照指示,我执行以下命令:

C:\Windows\System32>dotnet new -i IdentityServer4.Templates

然后我看到以下错误

C:\Program Files\dotnet\sdk\2.2.300\NuGet.targets(121,5): error : Unable to load the 

service index for source

https://pkgs.dev.azure.com/xxxxxx/_packaging/xxLibraries/nuget/v3/index.json.

[C:\Users\xxxx\.templateengine\dotnetcli\v2.2.300\scratch\restore.csproj]

C:\Program Files\dotnet\sdk\2.2.300\NuGet.targets(121,5): error : Response

status code does not indicate success: 401 (Unauthorized).

[C:\Users\xxxx\.templateengine\dotnetcli\v2.2.300\scratch\restore.csproj]

我以管理员身份运行命令提示符,并且按照一些答案的建议,我已经尝试了几次。

这是我的 nuget.confi 信息:

  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="xxxxLibrary" value="https://pkgs.dev.azure.com/xxxx/_packaging/xxxxLibraries/nuget/v3/index.json" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </packageSources>

标签: c#identityserver4

解决方案


我遇到了类似的问题,但我能够通过附加 nuget 源参数指定要使用的 nuget 源来解决它:

dotnet new -i identityserver4.templates --nuget-source https://api.nuget.org/v3/index.json

推荐阅读