Closed Steve887 closed 6 years ago
You can override it with config - https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?tabs=aspnetcore2x
Did it actually crash, or did it log the exception and then tell you it was using ephemeral keys? If the latter, and you want to use the registry then you need to follow the configuration steps for IIS.
Closing due to no response.
My application is using .net core Identity with Identity Server 4 to manage identity within my system.
I am trying to migrate up to .net core 2 and am running into a problem with the RegistryPolicyResolver.
My code sets up a WebHostBuilder using Kestrel and a Startup file to configure .net Identity and Identity Server:
In IdentityStartup
ConfigureServices
I am adding Data Protection like so:During start of the Web Host, I am getting a NullReferenceException in the constructor of RegistryPolicyResolver in the delegate of _getPolicyRegKey:
The part that is null is
Registry.LocalMachine
.Is there anything else I need to configure to fix this error, or, preferably, is there any way to override or turn off using the Registry all together? I note that
IRegistryPolicyResolver
is internal so I can just add my own version of it, andAddDataProtectionServices
inDataProtectionServiceCollectionExtensions
is private and always called so I can't override that.