我試圖在我的.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