9

I'm hosting a low-traffic ASP.NET MVC 5 application on a VPS with Windows Server 2012 R2 / IIS 8.5, with 1 GB of RAM.

My problem is that the first request after some time without any requests always gets a slow response - around 1.5 seconds according to Chrome Dev Tools. Subsequent refresh requests/responses only take about 45 ms.

I already did set Start Mode to AlwaysRunning on the application pool, and Preload Enabled to True on the website level, but it had absolutely no effect. Even if there are no changes/uploads whatsoever, after some time passes, with the next request it takes 1.5 s to get a response.

5

The problem is, you need to install the IIS feature Application Initialization. Then it should work with your configuration.

The image is from Rick Strahl's blog:

IIS Feature

Also remember to set:

  • Start Mode to AlwaysRunning on the application pool
  • Preload Enabled to True on the website level

You can set this settings without the Application Initialization Module be installed, but then they won't have any effect.

More Information here.

0

Is there potentially a version mismatch between the .NET Framework version that your website is targeting as compared to the .NET Framework Runtime version installed on the Web Server?

And are you deploying a website that is not precompiled and/or is updatable? -

Advanced Precompile Settings

.NET Runtime version upgrades are intended to be highly backwards compatible. However, I ran into a very similar issue when migrating multiple websites targeting the .NET 4.5.1 Framework from a Windows Server 2008 R2 server to a Windows Server 2012 R2 server patched up to the .NET 4.6 Runtime. All of my initial page loads (on multiple websites) began taking two minutes for each individual page, instead of a split second. And all of my experiments with different IIS settings were unsuccessful in resolving the issue.

Ultimately I was able to resolve the issue in one of two ways:

  1. Fully recreating the server, patched up to the .NET 4.5 Runtime did resolve my issue (along with adding a registry setting to block the install of .NET 4.6.1).
  2. Alternatively, redeploying my websites with "Precompile" checked and with "Allow to be updatable" unchecked also resolved my issue.

By contrast, all of my attempts to roll back or repair the .NET Runtime version on the server to the .NET 4.5 Runtime did not resolve my page load issues. (There is essentially no clean, reliable process to fully rollback a .NET Runtime short of re-imaging the server.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.