ASP.NET 开发服务器未更新对标记/代码的更改

发布于 2024-09-16 15:45:59 字数 256 浏览 10 评论 0原文

我最近一直在开发 ASP.NET 开发服务器(在一个 MVC 项目中,我发现它在如何服务我对代码所做的更改方面不一致。例如,我对 C#/在开发环境中运行 HTML/CSS/JS 并运行页面,更改会出现在屏幕上,但是如果我再次编辑 HTML 并再次运行页面,即使按 ctrl+F5 也不会出现新的更改。我必须停止 Web 服务器并再次运行应用程序才能进行更新,有其他人遇到过这个问题吗

? ctrl+F5 将始终使用我所做的更改来更新页面 我希望开发服务器同样可靠 有人有任何建议吗?

I've been working on the ASP.NET Development Server recently (on an MVC project and I'm finding that it is inconsistent in how it serves the changes I make to my code. For example, I make a change to the C#/HTML/CSS/JS in the dev environment and run the page, and the change appears on the screen. But if I edit the HTML again and run the page again, the new change doesn't appear. Even ctrl+F5 doesn't do it. I have to stop the web server and run the app again for the changes to update. Has anyone else experienced this? Is there a way to sort this problem out?

If I'm working in IIS and I change something, a ctrl+F5 will always update the page with the changes I've made. I'd like the dev server to be as reliable. Does anyone have any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2024-09-23 15:45:59

请尝试在每个请求上清除缓存

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));

如果仍然不起作用, 。在页面加载事件中尝试这堆代码

Response.AppendHeader("Pragma", "no-cache"); 
Response.AppendHeader("Cache-Control", "no-cache");

Response.CacheControl = "no-cache"; 
Response.Expires = -1;

response.ExpiresAbsolute = new DateTime(1900, 1, 1); 
response.Cache.SetCacheability(HttpCacheability.NoCache);

Try clearing cache.. on every request

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));

If Still not work. Try this bunch of code in pag load event

Response.AppendHeader("Pragma", "no-cache"); 
Response.AppendHeader("Cache-Control", "no-cache");

Response.CacheControl = "no-cache"; 
Response.Expires = -1;

response.ExpiresAbsolute = new DateTime(1900, 1, 1); 
response.Cache.SetCacheability(HttpCacheability.NoCache);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文