c# - 安装 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>
解决方案
我遇到了类似的问题,但我能够通过附加 nuget 源参数指定要使用的 nuget 源来解决它:
dotnet new -i identityserver4.templates --nuget-source https://api.nuget.org/v3/index.json
推荐阅读
- java - 如何使用 EasyMock 测试返回另一个方法的方法?
- javascript - CSS:带宽度的图像比例
- java - 如何使用 Spring Boot 在 Postgresql 中插入用户输入的日期
- php - Laravel collection->push() 无法正常工作
- javascript - react-native 中的分析器损坏(V8 和 systrace)
- python - 如何停止 docker 数据库容器
- ios - 从 Nativescript 5 -Nativescript 6 迁移 - IPA 文件大小在发布版本中太大
- firebase - 在 Firebase 中向同一项目下的多个应用发送推送通知
- php - 本地和远程网站之间的通信
- ruby - 如何将所有文件和子文件夹从一个文件夹复制到 Ruby 中同一 AWS S3 存储桶中的另一个文件夹