user1902139
user1902139

Reputation: 11

Why is pre-compiling my ASP .NET MVC project not improving my first time access speed?

I have tried two things. One is pre-compiling my ASP.NET MVC 3 project using aspnet_compiler, and the other is using RazorGenerator in the project to allow the views to be compiled. Using both methods, I still see that pages in my site are having to compile on the first access. I see csc.exe running on the server when they are first accessed and it doesn't happen the next time. Why are these pre-compiling steps not preventing this and thus letting me have faster first time access?

Upvotes: 1

Views: 1593

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039408

Pre-compiling an application won't improve the first request startup time because there are still many things that need to happen when the first request arrives:

  • The Application_Start method executes
  • Controllers and Views location are retrieved and cached for subsequent requests
  • ...

You could use the AutoStart feature of IIS 7.5 and ASP.NET 4.0 if you want to preload an application in memory when the web server starts. This way the application will be hot and waiting for the first request.

Upvotes: 1

Related Questions