Identityserver4: [Question] Startup.cs - throw new Exception("need to configure key material");

Created on 25 Feb 2018  路  7Comments  路  Source: IdentityServer/IdentityServer4

Hi,

This is not a bug, just a question.
When I tryed to execute dotnet MyIdServer.dll /seed
I got : throw new Exception("need to configure key material");

I did this :
`

if DEBUG

            var certPath = Path.Combine(Directory.GetCurrentDirectory(), "Cert", "MyIdServerLocalhost.pfx"); //IISExpressCertificate
            X509Certificate2 cert = new X509Certificate2(certPath, "MyLocalhostCertPassword");

else

                var certPath = Path.Combine(Directory.GetCurrentDirectory(), "Cert", "MyIdServer.pfx");
                X509Certificate2 cert = new X509Certificate2(certPath,"MyProductionCertPassword");

endif

builder.AddSigningCredential(cert);
`

My question is :
This means when you seed the database for production, you cannot use it in localhost test mode because some encryption is different ?

If yes, do I have to seed a first database for localhost with a first connectionstring and a second one for production ?

Thanks

question

All 7 comments

Also - learn about the hosting environment concept in ASP.NET Core - this is orthogonal to DEBUG.

Closing. If you still have issues, feel free to reopen.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings