使用秘密管理器工具的ASP .NET Core 1.1 web api
问题描述:
我试图在我的.net核心web api应用程序中设置谷歌登录。我一直遵循本指南:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins使用秘密管理器工具的ASP .NET Core 1.1 web api
但出于某种原因,我得到这个错误:
'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();
}
呵呵,我不知道我是怎么错过的。谢谢! – hs2d