Created
August 20, 2012 21:10
-
-
Save tqheel/3407921 to your computer and use it in GitHub Desktop.
How to force an ASP.Net application to recompile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//As suggested at http://forums.asp.net/t/1569137.aspx/1 | |
//This is an ugly hack but I needed a way to force the application to recompile on production server. | |
//Entity Framework was not updating cached values with the latest values from the db | |
//I tried many other suggested means of fixing this problem to no avail. | |
//This was a last resort. Has to be done within the context of an httpRequest object | |
System.IO.FileInfo fi = new System.IO.FileInfo(Server.MapPath("~/Web.config")); | |
fi.LastWriteTime = DateTime.Now; | |
//The hack changes the web.config's "last changed" date, which causes ASP.Net to recompile. | |
//Not pretty, but it works. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment