JohnW
JohnW

Reputation: 3032

Precompiling asp.net solutions for deployment

I'm using aspnet_compiler.exe to precompile my application for deployment.

However, I don't think it's working, for two reasons:

Here's specifically what I'm doing:

  1. Build the solution in studio.
  2. execute aspnet_compiler.exe -v /Foo -p c:\builddir c:\deploydir (where Foo is the vdir my app runs under, c:\builddir is where studio builds to, and c:\deploydir is the location where
  3. I then copy c:\deploydir to the web server.
  4. I access http://localhost/Foo
  5. After 30 seconds, the app displays, and I can see that assemblies have been generated in Temporary ASP.NET Files.

If it's notable, I'm using .net 3.5 SP1/Studio 2008 SP1. compilation debug=false is also set in web.config.

Upvotes: 2

Views: 1398

Answers (2)

Mehrdad Afshari
Mehrdad Afshari

Reputation: 422182

Your two points are moot:

  1. ASP.NET precompilation doesn't result in native image generation so JIT overhead will still be there. There might be a worker process creation overhead too.

  2. ASP.NET precompilation has the option to compile everything (incl. ASPX stuff, ...) or just source code (which you can specify with the -u switch). In case of the latter, those assemblies will still be generated for ASPX files. In case of the former, what you are seeing is not assembly generation. The runtime just copies and caches the assemblies in /bin in Temporary ASP.NET Files. You can confirm this fact by comparing the assemblies byte by byte and see that they are identical.

Upvotes: 2

Andrew Hare
Andrew Hare

Reputation: 351638

Precompiling the website with aspnet_compiler.exe doesn't JIT compile the code - you would need to ngen the code to do that.

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.

Upvotes: 1

Related Questions