<p>I am developping a (relatively small) website in ASP.Net 2.0. I am also using nAnt to perform some easy tweaking on my project before delivering executables. In its current state, the website is "precompiled" using </p>

<blockquote>
  <p><code>aspnet_compiler.exe -nologo -v ${Appname} -u ${target}</code></p>
</blockquote>

<p>I have noticed that after the IIS pool is restarted (after a idle shutdown or a recycle), the application takes up to 20 seconds before it is back online (and Application_start is reached).</p>

<p>I don't have the same issue when I am debugging directly within Visual Studio (it takes 2 seconds to start) so I am wondering if the aspnet_compiler is really such a good idea.</p>

<p>I couldn't find much on MSDN. How do you compile your websites for production?</p>

[{'answer_id': 56360, 'author': 'Simon Steele', 'author_id': 4591, 'author_profile': 'https://Stackoverflow.com/users/4591', 'pm_score': 3, 'selected': True, 'text': "<p>Make sure that:</p>\n\n<ol>\n<li>You are using a Web Application project rather than a Web Site project, this will result in a precompiled binary for your code behind</li>\n<li>You have turned off debug code generation in the web.config file - I guess if this is different to when you used aspnet_compiler the code may be recompiled</li>\n</ol>\n\n<p>If you've tried those, you could maybe try running ngen over your assembly thus saving the JIT time?</p>\n"}, {'answer_id': 56365, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 1, 'selected': False, 'text': '<p>Make sure this is set in web.config <code>&lt;compilation debug=false&gt;</code>. In my case, I also have a batch file which issue Get requests for all the main pages before giving to users (page loading simulation).</p>\n'}, {'answer_id': 56372, 'author': 'Luk', 'author_id': 5789, 'author_profile': 'https://Stackoverflow.com/users/5789', 'pm_score': 0, 'selected': False, 'text': "<p>@Simon:</p>\n\n<ul>\n<li>The project is a Web Application. Websites are then slower to startup (I had no idea it had an incidence, beside the different code organization)?</li>\n<li>I checked, and while I edit the web.config after aspnet_compiler is called, I don't touch the debug value (I will however check the website is not faster to startup if I don't touch the web.config, just to make sure)</li>\n</ul>\n\n<p>(And I will definitely have a look at ngen, I was not aware of that tool.)</p>\n"}, {'answer_id': 56395, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>If your website is compiled as updatable, you'll see a bunch of .ASPX files in your virtual directory.  These must be compiled on startup.  That's so you can come in and alter the web UI itself.  This is default for both websites and web applications.</p>\n"}, {'answer_id': 56435, 'author': 'Steve Morgan', 'author_id': 5806, 'author_profile': 'https://Stackoverflow.com/users/5806', 'pm_score': 2, 'selected': False, 'text': "<p>For ultimate reponsiveness, don't allow your app to be shutdown.</p>\n\n<p>The first method is to make sure that it's incredibly popular so that there's always someone using it.</p>\n\n<p>Alternatively, fetching a tiny keep-alive page from somewhere else as a scheduled activity can be used to keep your site 'hot'.</p>\n"}, {'answer_id': 5573219, 'author': 'Tim P.', 'author_id': 613620, 'author_profile': 'https://Stackoverflow.com/users/613620', 'pm_score': 1, 'selected': False, 'text': '<p>The key is to make sure the IIS Application Pool never shuts down.  This is where the code is actually hosted.  Set the "Idle Timeout" (Under Advanced Settings) to something really high, like 1440 minutes (24 hours) to make sure it\'s not shut down as long as somebody hits your site once a day.</p>\n\n<p>You are still going to have the JIT time whenever you deploy new code, or if this idle timeout period is exceeded witout any traffic.</p>\n\n<p><a href="http://technet.microsoft.com/en-us/library/cc771956%28v=ws.10%29.aspx" rel="nofollow">Configuring IIS 7.x Idle Timeout</a></p>\n'}]
['https://Stackoverflow.com/questions/56357', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5789/']