سؤال

I'm having trouble understanding when the site is considered "pre-compiled". As I understand what I've read, if I use the Publish or Build Deployment Package options from within Visual Studio then it is pre-compiling, but if I just use something like xcopy, then it is not pre-compiled. Is that correct?

هل كانت مفيدة؟

المحلول

ASP.NET WebSite projects have an option of xcopy deployment in which all files including the aspx, aspx.cs, ascx, ascx.cs etc are copied to the production web server as is. The ASP.NET runtime compiles the site when it receives the first request. If you check the folder C:\Windows\Microsoft.NET\Framework\v\Temporary ASP.NET Files, you could see the output. This obviously is very easy for deployment as all we have to do is to copy the files over to the web server. However, the first visitor pays the price in terms of when the site gets compiled for the first time. The publish option does this work before the deployment. It compiles the website project and produces assemblies that are ready to run. There is an option in the publish to leave the aspx files as is so that those can be modified. In both cases there are no .cs files as those have been compiled to the assemblies. Check Walkthrough: Publishing a Web Site for more details.

HTH

نصائح أخرى

It is "compiled" in the sense that you will have a MSIL DLL of your web code. However, you will still have to have the JIT compilation. You should use the NGEN utility if you are using .NET 2.0 or greater to prevent this warm-up time. Please note, NGEN is only useful to eliminating the first "startup" time of the application. It does make it harder to maintain because JIT'ed code can get out of sync with NGEN'd code. In my enterprise environment, we chose not to use NGEN because of those potential pitfalls.

See the links below:

Does it help to use NGEN for ASP.NET Applications?

Microsoft Documentation on NGEN utility

Potential Pitfalls of using NGEN

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top