I'm using the standard web deploy in VS 2019:
It typically only happens if I change the backend code. If I change JS/CSS/HTML, it doesn't return an HTTP 500, but the content is cached. Which I think I can fix that. But the 500 error happens every time the C# code is updated.
Is there a special way I should be publishing to prevent this?