Blazor default template fails with HTTP Error 502.5 with .NET Core 2.1 SDK RTM

asp.net-core blazor

Question

If you have installed .NET Core 2.1 SDK, when running a solution with the "ASP.NET Core Web Application" template using the "Blazor (ASP.NET Core Hosted)" project type the client app fails to load displaying the error:

HTTP Error 502.5 - Process Failure

Popular Answer

This issue is reported on the Blazor GitHub issue 1424 but do not do as suggested and delete your global.json file.

The solution is to modify your global.json file to have your installed SDK version.

I've got dotnet 2.1.3 installed and 2.1.300 uin my Balzor project's global.json file, and am getting the same error

It turns out I've got '2.1.500-preview-009297' of the dotnet SDK!

To find the highest version of the dot net SDK run this script in the Powershell ISE:

$runtimes = [Collections.Generic.List[string]];
$runtimes = (ls "$env:programfiles/dotnet/shared/Microsoft.NETCore.App").Name
$runtime = $runtimes[$runtimes.Length-1]
$runtime
cd $env:programfiles/dotnet/shared/Microsoft.NETCore.App
cd $runtime
dotnet --version

copy and paste the last string into your global.json file:

{
  "sdk": {
    "version": "highest sdk version"
  }
}



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why