Is it possible to pre-compile ASP.Net website on a stopped IIS 6 site?
I have 2 sites on IIS, one is the live site and the other is a site that is only started when there is maintenance being carried out on the live开发者_JS百科 site.
In a deployment scenario I STOP the live site and the START the maintenance site so that users receive a friendly message advising of the upgrade.
The only issue I have is when I start up the live site it obviously has to JIT and this can take up to 3 minutes.
Is there anyway to have this JIT before I unleash it to the users?
EDIT: Just to clarify, this site is a CMS, so the marked answer below works for me due to only having 1 page to compile.
Thanks
Looks like you will need to use NGen...
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.
Precompile the website for deployment, using fixed names, deploy the solution to the server, and then ngen all assemblies in bin
MSDN article on NGen.
I should add that by pre-generating the native code like this you may lose some optimizations that the runtime performs based on the current system performance such as memory and register use. This might even result in the site running slower than if it were JIT'ed. Microsoft recommends that you try both the NGen and JIT approaches on the target platform under conditions approximating those found under normal use.
The only way I can think of is to change the bindings on the stopped site, start it, run a page, apply the bindings, turn off maintenance site and start the live site.
I don't believe there is anything out of the box that would do this. In fact, the IIS7 warmup module that they just released a few months ago just basically crawls and hits up your pages once to "warm them up".
If I were you, I would write a little program that makes WebRequests of each page. There may be a third-party tool out there which would do this quickly and easily, though, so it's still a good question...
you can use the aspnet_compiler.exe to precompile your web site. You can use it from the command line or call it from a nant script.
[aspnet_compiler][1]
[1]: http://msdn.microsoft.com/en-us/library/ms229863%28VS.80%29.aspx />
精彩评论