C# 如何在运行时重新加载asp.net核心标识选项

C# 如何在运行时重新加载asp.net核心标识选项,c#,asp.net,asp.net-identity,asp.net-core-2.0,asp.net-core-identity,C#,Asp.net,Asp.net Identity,Asp.net Core 2.0,Asp.net Core Identity,我们已经实现了一个管理系统,允许管理员更改密码复杂性规则。启动时,这些选项将应用于services.AddIdentity(setupAction)中的asp.net核心标识。 因此,每当我们重新启动服务器应用程序时,都会应用这些选项。 如何在运行时强制重新加载这些设置(无需重新启动应用程序)不要在启动时设置选项。而是添加自定义密码验证程序: services.AddIdentity<ApplicationUser, IdentityRole>() .AddEntityFra

我们已经实现了一个管理系统,允许管理员更改密码复杂性规则。启动时,这些选项将应用于
services.AddIdentity(setupAction)
中的asp.net核心标识。 因此,每当我们重新启动服务器应用程序时,都会应用这些选项。
如何在运行时强制重新加载这些设置(无需重新启动应用程序)

不要在启动时设置选项。而是添加自定义密码验证程序:

services.AddIdentity<ApplicationUser, IdentityRole>()
    .AddEntityFrameworkStores<ApplicationDbContext>()
    .AddDefaultTokenProviders()
    .AddPasswordValidator<UsernameAsPasswordValidator<ApplicationUser>>();

services.AddIdentity

我有点希望找到避免这种情况的方法。但是谢谢你的提示,我们可能不得不退一步。