2

I have an asp.net web application running on an IIS 7.5/.NET Framework 4.0 server. Whenever I navigate to any webpage running on this server, it takes about 12 seconds to initially load. After that, navigation is quick (about 0.5 seconds, even on heavy hitting pages). If you leave it idle for two minutes, it slows again for the next request. I can tell that this is because the connection time-out is set to 120 seconds...I am guessing that after that limit, the site must reload everything when the next page is requesting. This site does call two different databases, however, default page should not do so and suffers the long initial load time. I have tried setting up Application Initialization for IIS 7.5, but noticed very marginal change at best after this was done. From what I've been reading, there seems to be very mixed success with this module in IIS 7.5. Is there any other means of circumventing this load time without having to rely solely on a high connection timeout value, since that would not resolve initial load time anyway?

SausageBuscuit
  • 1,226
  • 2
  • 20
  • 34
  • 1
    Is there a database involved? I don't see that noted. – Techie Joe Oct 22 '13 at 22:46
  • 1
    I hope this will help you: http://stackoverflow.com/questions/13386471/fixing-slow-initial-load-for-iis –  Oct 22 '13 at 23:42
  • 1
    What is it loading in those 12 seconds? – Zerkey Oct 23 '13 at 02:23
  • @TechieJoe the site does call out to 2 different dbs, but even pages that don't reach out to them are slow initially, and then things speed up after that inital load. Even pages that have heavy db access are quick during that time until next application pool connection timeout (NOT IIS idle timeout). – SausageBuscuit Oct 23 '13 at 05:11

2 Answers2

3

When a WebApp is idle for along time IIS will close the application to save resources. This might have happened in your case.

Its also said that the application would turn off if the last user session timed out. I hope this article will guide you properly.

Look at what happens when the request gets to the runtime.

  1. When ASP.NET receives the first request for any resource in an application, a class named ApplicationManager creates an application domain. (Application domains provide isolation between applications for global variables, and allow each application to be unloaded separately.)
  2. Within an application domain, an instance of the class named Hosting Environment is created, which provides access to information about the application such as the name of the folder where the application is stored.
  3. After the application domain has been created and the Hosting Environment object instantiated, ASP.NET creates and initializes core objects such as HttpContext, HttpRequest, and HttpResponse.
  4. After all core application objects have been initialized, the application is started by creating an instance of the HttpApplication class.
  5. If the application has a Global.asax file, ASP.NET instead creates an instance of the Global.asax class that is derived from the HttpApplication class and uses the derived class to represent the application.

See How it happens

How it happens!!!

Subin Jacob
  • 4,692
  • 10
  • 37
  • 69
  • Guide was helpful, but the issue here was being caused by 3rd party software trying to load files that weren't there. See the answer below. – SausageBuscuit Oct 24 '13 at 14:02
2

Was not related the connection timeout as I thought it was, but rather another timeout and necessary files missing. Per Zerkey's question in the comments above, I got a little curious and looked around for ways to see what was loading, as debugging it from my PC was still slow, but considerably faster (about 4-6 seconds). In IIS on the server this is published to, I went to Worker Processes, selected the process and clicked current requests on the right. This showed me that it gets hung up on a 3rd party mobile redirection service I am using called 51degrees.mobi. It was taking about 10 of those 12 seconds for those file to load. What was happening is that the logging capabilities were set to log in an App_Data folder, and that directory was missing. It evidently wasn't giving me a visible error, it was just trying it and failing. Once I added this directory and log file, and reactivated Application Initialization, everything is quick.

SausageBuscuit
  • 1,226
  • 2
  • 20
  • 34