question

GaultierLarge-7766 avatar image
0 Votes"
GaultierLarge-7766 asked ·

Use web app managed certificate in Asp.net Core app

Hi,

I got some issue when i want to use managed certificate in my asp.net core

I configure the WEBSITE_LOAD_CERTIFICATES with * or with the thumbprint of my certificate, i have tried with another certificate that i create with VS

My web app respond with 404 error, i guess it doesn't start


The code to load my cert : > public X509Certificate2 LoadCert() { X509Certificate2 cert = null; using (X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser)) { certStore.Open(OpenFlags.ReadOnly); X509Certificate2Collection certCollection = certStore.Certificates.Find( X509FindType.FindByThumbprint, // Replace below with your cert's thumbprint "EC253E523D93CBC41A24B95223F472CCE0110B93", false); // Get the first cert with the thumbprint if (certCollection.Count > 0) { cert = certCollection[0]; Log.Logger.Information($"Successfully loaded cert from registry: {cert.Thumbprint}"); } } // Fallback to local file for development if (cert == null) { Log.Logger.Information($"Falling back to cert from store."); } return cert; } > Blockquote

If I delete the setting, my app work, but i have a 500 error because i can't find the certificate that i want to load

azure-webapps-ssl-certificates
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers