Rules to Better IIS - 3 Rules
Optimize your web hosting experience with key rules for managing Internet Information Services (IIS). These guidelines focus on maintaining application pools, troubleshooting downtime, and implementing secure URL redirection to enhance your website's performance and security.
Do users complain that at times their web application appears to be slow to run at times. The issue can be related to after IIS application pool recycles/reboots/crashes and the application pools are not automatically loaded back into into memory e.g. The first user in the morning complains about excessive load times for their web application.
As per What's New in IIS 8? you can use the Application Initialization feature to alleviate this behaviour. If this setting is not enabled, then IIS has default settings to spin down the application and release it from memory when it has been idle for 20 minutes.
When you set the startMode property of your application pool to AlwaysRunning a worker process is spawned as soon as IIS starts up and does not wait for the first user request. But this does not mean the web application is initialized.
When you set preloadEnabled to true, IIS will simulate a user request to the default page (can be changed with initializationPage metabase setting) of the website/virdir so that the application initializes. The request is not logged in the IIS logs.
IIS 8 configuration:
The feature is built-in to IIS 8
- Open Internet Information Services (IIS)
- Browse to the website in question
-
Open Advanced settings
-
Change the “start mode” to “Always running”
- Change Preload Enabled to True
Instructions below for IIS 7.5:
- On the application server install http://www.iis.net/downloads/microsoft/application-initialization or it can be installed using the Web Platform installer
- Open Internet Information Services (IIS)
- Select the server
- Scroll down and select Configuration Editor
- From the Section menu select system.applicationHost / applicationPools
- Double click the “…” to the right of (Collection)
- Find the Application Pool CFT is running on (it could be ComplyFirstTime or DefaultAppPool)
- In the Properties window, scroll down and select startMode , choose AlwaysRunning
- On the top right select Apply
Alternative Instructions for IIS 7.5:
-
There is a setting that has to be enabled in the applicationhost.config file which contains all of the top level configuration settings that IIS uses. This file is called appplocated at c:\windows\system32\inetsvr\config on a standard install of IIS. We recommend making a backup of this file before continuing. You can use any text editor to update this file. Search for and locate the section named <applicationPools>. Within this section, you will see your application listed in this format:
<add name="”Application" pool="" name”="" managedruntimeversion="”v4.0″"></add>
-
Add the Always Running mode by adding startMode="AlwaysRunning"
<add name="”Application" pool="" name”="" managedruntimeversion="”v4.0″" startmode="AlwaysRunning"></add>
- Save this file and perform an IISReset so that the change is read into the running memory of the IIS server.
When a site is down, you have to troubleshoot the problem. During troubleshooting, you might need to restart the IIS services. Here're several steps you can follow.
- Restart the website
- If step 1 doesn't work, try to recycle the application pool of the site
- If step 2 doesn't work, try to restart IIS
- If step 3 doesn't work either, then reboot the web server machine (step 3 or step 4 is a severe action. You should get the approval of network administrators or ask them to do this)
- If the site is still not working, turn on the maintenance page and then try to reproduce the problem on the testing site. DO NOT connect your testing site to the production database. If you need the production database, make a copy of it and restore it to your testing machine.
Still not fixed? Escalate the issue. Please refer to the technical support team.
Using IIS URL Rewrite Module, Web administrators can easily set up rules to define URL rewriting behavior based on HTTP headers, HTTP response or request headers, IIS server variables, and programmatic rules. HTTP to HTTPS redirect helps boost your Google site ranking as well as adding enforcing SSL security.
First you must download the IIS URL Rewrite module from Web Platform Component Installer. Ensure that a valid SSL Certificate is installed in IIS Server.
- Open URL Rewrite and begin with Add Rule(s) | Blank rule (Inbound rules)
- Name the rule "HTTP to HTTPS redirect"
- Add Pattern
(.\*)
- Add Conditions
- Condition input:
{HTTPS}
- Pattern:
off
- Add Action
- Action type:
Redirect
- Action Properties:
https://{HTTP\_HOST}/{R:1}
- Redirect type:
Found (302)
- Apply | Back to Rules