gpt4 book ai didi

asp.net - 使用 Secret Manager 工具的 ASP .NET Core 1.1 web api

转载 作者:行者123 更新时间:2023-12-01 10:30:24 26 4
gpt4 key购买 nike

我试图在我的 .net 核心 web api 应用程序中设置谷歌登录。我一直在关注本指南:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins

但由于某种原因,我收到此错误:

'IConfigurationBuilder' does not contain a definition for 'AddUserSecrets' and no extension method 'AddUserSecrets' accepting a first argument of type 'IConfigurationBuilder' could be found (are you missing a using directive or an assembly reference?)



这是我的启动方法,这里没什么特别的:
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

if (env.IsDevelopment())
{
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets<Startup>();
}

builder.AddEnvironmentVariables();
Configuration = builder.Build();
}

最佳答案

您需要添加相关的包才能使用它。该包名为 Microsoft.Extensions.Configuration.UserSecrets ,您可以通过 here 了解更多信息。

关于asp.net - 使用 Secret Manager 工具的 ASP .NET Core 1.1 web api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43255160/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com