无法调试 Global.asax,因为 Windows 7 上的 .NET 4 x64 MVC3 中的缓存无法清除
我正在尝试调试我的 Global.asax,并且正在执行所有“正确”的操作,例如
- 停止 Casini Webserver(右键单击,停止)
- 使用 System.Diagnostics.Debugger.Break();在
Application_start
中, - 我什至使用以下“System.Diagnostics.Debug.WriteLine("Register globalfilters");'并且什么也没写。
最后,在最后的手段下,我删除了 Global.ASAX 中的所有内容(所有路由),并且应用程序继续正常运行。
然后我删除了 /bin 和 /obj 文件,并运行了以下批处理文件
iisreset /stop
rmdir /q /s "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files"
rmdir /q /s "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
rmdir /q /s "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
md "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
xcacls "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
rmdir /q /s "C:\WINDOWS\Microsoft.NET64\Framework\v1.1.4322\Temporary ASP.NET Files"
rmdir /q /s "C:\WINDOWS\Microsoft.NET64\Framework\v2.0.50727\Temporary ASP.NET Files"
rmdir /q /s "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework64\v1.1.4322\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files"
md "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"
xcacls "C:\WINDOWS\Microsoft.NET\Framework64\v1.1.4322\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
iisreset /start
pause
现在我终于能够通过搞砸的 Global.aspx 文件来破坏我的应用程序。我知道系统正在“看到”更新的文件,这让我有点松了口气。现在我替换了内容并保存了它,我仍然无法重新加载我的应用程序。
现在,无论我做什么,应用程序都无法加载。即使我纠正了问题,它仍会记住我损坏的 aspx 文件。
如何强制重新加载 Global.Aspx?
I'm trying to debug my Global.asax, and am doing all the "right" things such as
- Stop the Casini Webserver (right click, stop)
- Use
System.Diagnostics.Debugger.Break();
inApplication_start
- I'm even using the following 'System.Diagnostics.Debug.WriteLine("Register global filters");' and nothing gets written.
Finally in an effort of last resort, I deleted everything (all routes) in the Global.ASAX and the application continued to run fine.
I then deleted the /bin and /obj files, and ran the following batch file
iisreset /stop
rmdir /q /s "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files"
rmdir /q /s "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
rmdir /q /s "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
md "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
xcacls "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
rmdir /q /s "C:\WINDOWS\Microsoft.NET64\Framework\v1.1.4322\Temporary ASP.NET Files"
rmdir /q /s "C:\WINDOWS\Microsoft.NET64\Framework\v2.0.50727\Temporary ASP.NET Files"
rmdir /q /s "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework64\v1.1.4322\Temporary ASP.NET Files"
md "C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files"
md "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"
xcacls "C:\WINDOWS\Microsoft.NET\Framework64\v1.1.4322\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
xcacls "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" /E /G MYMACHINE\IIS_WPG:F /Q
iisreset /start
pause
And now I was finally able to break my application by having a screwed up Global.aspx file. I'm somewhat relieved that I know the system is "seeing" the updated file. Now I replaced the contents, saved it, I'm still unable to get my application to reload.
Now no matter what I do, the application does not load. It is remembering my mangled aspx file, even though I corrected the issue.
How to I force a reload of Global.Aspx?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MVC 网站是为 x86 平台设置的,这要么混淆了问题,要么就是根本原因。
将其更改为 Any CPU 似乎已经纠正了问题
The MVC website was set for the x86 platform, and that either confused the issue, or was the root cause.
Changing this to Any CPU seems to have corrected the problem
您需要重建代码才能看到 global.asax 中的更改。创建新的构建或重建还将回收 Cassini 或 IIS 中的应用程序。
You need to rebuild your code before you see the changes in global.asax. Creating a new build or rebuild will also recycle the application in Cassini or IIS.
您的 GAC 中是否有一些 DLL 并且需要刷新?
Do you have some of these DLLs in the GAC and they need refreshed?