ASP.NET Razor views are not updating when simply updating html. I'm trying to add a few elements on a page when my application is running in debug mode, and the changes are not being seen in the browser when I refresh the page. However, if I stop and restart the application, the changes are seen.
I've tried disabling cache, sending back headers (pragma no-cache), shift reload on the browser, nothing seems to work.
This is quite frustrating having to continually bounce the app.
What I'm using: asp.net 4.5, IISExpress, visual studio 2013.
Does anyone know how to turn off the output cache so I can debug without having to restart the entire application?
thanks
As of September 2019, there's a bug in visual studio which prevents razor views from updating unless you restart the server after every update. Very annoying!
To fix:
1- Add the NuGet package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
2- Modify the ConfigureServices method in startup.cs
Replace
services.AddControllersWithViews();
with
services.AddControllersWithViews().AddRazorRuntimeCompilation();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With