Error:

Publishing a new Blazor app with Identity to Azure App Service giving the following error:

HTTP ERROR 500

Fix:

Steps:

  1. Windows PowerShell (Admin mode)
PS C:\WINDOWS\system32> New-SelfSignedCertificate -Subject "CN=MyAppCert" -CertStoreLocation "cert:\LocalMachine\My"
   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My

Thumbprint                                Subject
----------                                -------
A123ABBBAB3FA6514806D32D618541B55CC93333  CN=MyAppCert
  1. Manage computer certificates
  • Certificates – Local Computer -> Personal -> Certificates
  • Right click on certificate -> Export
  • Enable Password and select “TripleDES-SHA1”
  1. Upload pfx file to Azure App Service
  • Get Thumbprint and Subject Name
Thumbprint: A123ABBBAB3FA6514806D32D618541B55CC93333
Subject Name:  MyAppCert
  1. New Configuration in Azure App Service
Name: WEBSITE_LOAD_CERTIFICATES
Value: A123ABBBAB3FA6514806D32D618541B55CC93333
  1. Add to appsettings.json
    "Key": {
      "Type": "Store",
      "StoreName": "My",
      "StoreLocation": "CurrentUser",
      "Name": "CN=MyAppCert"
    }

Sources:

https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-identity-server?view=aspnetcore-5.0&tabs=visual-studio

Last modified: January 12, 2021

Author

Comments

Write a Reply or Comment