As everyone with ASP.Net knows.... when the server's IIS restarts, ASP.Net needs to recompile the website and restart the application.
Restarting the application I can cope with.... as that only adds about 500ms to the initial response time
But recompilation can takes fricking ages (sometimes as much as 60 seconds)
I was wondering if anyone knew any ways to keep ASP.Net applications recompiled or the best way to get IIS to recompile applications after it restarts (I understand there's some trick I could use with Global.asa (not asax) to call all the other applications
Without ASP.NET V2 which has a precompile option, your best bet is something like this
As I recall from memory the aspx, ascx and asmx files are compiled per directory on first use.
In your case if you have all your files in the same folder all those files gets compiled.
(but I see you have a folder for controls...)
Do you happen to have some/a lot of aspx files in your root folder? Maybe the above rule should read 'on first use and all files in the root folder'.
Concluding: You might try scattering your files over more folders (and perhaps move them out of the root folder).
The first time you browse to an updated ASP.NET website, there's always a couple of seconds pause whilst the ASP.NET worker process does something. But why should there be a wait when you've just built the web application into an assembly using VS.NET? The
reason is quite surprising: ASP.NET applications using the code-behind model actually comprise
two separate assemblies at runtime. Rather than interpreting the .aspx page, ASP.NET creates a class that dynamically spits out the HTML content when instantiated. This class inherits from the class created in code-behind view, so that both are linked
together. The pause when you first browse to the site is caused by this class being generated, compiled and instantiated. On subsequent visits to this page, the class is already compiled (and probably also JITted), so the only step left is to instantiate it.
That's why repeated visits to a page are so much faster than the initial visit. (In production this is rarely a problem, since web sites are of course long lived and used by many users.) If you want to see the class that's automatically generated, you can
visit a directory called Temporary ASP.NET Files (on my machine stored at
\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files). Buried in here, you'll see an XML file for each page in the site, which contains the name of the automatically generated C# or VB class that implements the dynamic HTML rendering. As
with tip #2, this location is deliberately obfuscated to prevent casual tampering, but it's worth looking here just to see what's going on under the covers.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.