Visual Studio 2020 Hot Reload isn't working

Viewed 76

I am using Visual Studio 2022 v 17.2.1 to create an ASP.NET Core/6 app.

When I make HTML only changes to my Razor Views, and I try to hot reload the page, I get the following

enter image description here

Here are my Hot-Reload settings

enter image description here

How can I get the Hot-Reload function working so I don't have to restart my app every time I want to see the change in the browser?

1 Answers

One possibility is that you are using Response Compression Middleware (UseResponseCompression()) in the Program.cs file.

It seems that this middleware is no longer needed for Blazor Webassembly, and that for some people removing the installation of the middleware UseResponseCompression() fixes the problem of getting an error when attempting to hot reload. Some Microsoft documentation says to use the compression middleware, but this breaks the hot reload functionality, in my exprience. Once this call is removed, hot reload works for running with the Debugger attached and not attached.

Related