本文介绍了在调试VS MVC网站时,如何确保不缓存我的脚本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我今天遇到了一个问题,我正在开发的网络程序的唯一方法是显示修改后的脚本的最新副本是重启机器。它是捆绑在主布局页面中的文件,位于脚本包中。我尝试了CTRL-F5并删除了IE11的Internet选项中的所有文件(我认为)以确保它没有使用缓存副本,但这还不够。I came across a problem today where the only way for the web program I am developing showed the most recent copy of a modified script was to reboot the machine. It is a file bundled in the master layout page, in a script bundle. I tried CTRL-F5 and deleted all files (I think) in Internet Options of IE11 to ensure it wasn't using the cached copy, but that was not sufficient.然后我怀疑原因与我在VS2010中使用VS Development服务器的事实有关。我试图杀死WebDev.WebServer40.exe,假设它在那里缓存它,但那也不是。我将测试作为基本测试,将脚本文件的整个内容修改为单个alert()消息,该消息从未出现,直到我重新启动计算机。I then suspected the cause is related to the fact I am using the VS Development server in VS2010. I tried killing WebDev.WebServer40.exe, hypothesizing it was caching it there, but that was not it either. I made the test as basic as modifying the entire contents of the script file to be a single alert() message, which never appeared, until I rebooted the machine. I已经看到了在引用文件时将args添加到文件中的建议,或者在每次构建时重命名它,但显然在新开发中运行多次迭代时效率不高。我想知道是否有一个Visual Studio或Internet Explorer选项可以保证每次构建加载未缓存的文件? IE是否也可能在其他一些我需要注意的内存空间中缓存此信息?谢谢I've seen suggestions to add args to the file when referencing it, or rename it each build, but clearly that's not productive when running many iterations in new development. I am wondering if there's perhaps a Visual Studio or Internet Explorer option here that guarantees to load the un-cached file each build? Is IE also possibly caching this info in some other memory space I need to be aware of too? thanks 编辑: 好​​吧,事实证明问题的根本原因是修改脚本文件后的构建后步骤我正在努力。因此,重新启动是一个巧合。一如既往,责怪作家。 :)。但是,我已经看到这个问题在过去多次发生,真的,如果有可用的浏览器设置(具体细节)确保脚本(和CSS文件)从未在开发中缓存,我仍然很好奇。Ok, it turns out the root cause of the problem was a post-build step modifying the script files I was working on. Rebooting was therefore a coincidental fix. As always, blame the writer. :). However, I have seen this problem occur many times in the past, genuinely, and am still curious if there's browser settings available (with specifics) that ensure scripts (and CSS files) are never cached, in development.推荐答案禁用浏览器缓存。通过调试器或开发人员工具访问(通常为F12)。Disable the browser cache. Accessed through the debugger or developer tools (usually F12).以下是一些示例: Chrome Firefox IE11 这篇关于在调试VS MVC网站时,如何确保不缓存我的脚本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 15:57