How to configure IIS Web Site and Application Pool in Microsoft Failover Cluster

Posted on February 12, 2014



OS = Windows 2008R2

Cluster Nodes = Two


I have an application which have few Virtual Web Sites hosted on IIS, few Application Pools and few windows services. We need to monitor Virtual Web Sites and Application Pool, if they stop responding the Cluster Service Group can failover to other Cluster Node. The same we cannot do in case we use Windows NLB.


  • Microsoft Failover Cluster should be installed on OS.
  • You must have a domain user with appropriate rights on both cluster nodes.
  • Web site should be working on standalone node.
  • SAN should be connected with both cluster nodes. This we required to keep the website on shared location.
  • WWW publishing service in windows services should be manual.


  • Configure an empty Cluster Service Group.See the below snap for reference.


  • Create a Generic Script resource in the Cluster Service Group

Create a Generic Script resource in the Cluster Service Group which we created above. See the below snap for reference.


Now click NEXT and mention the path of the script. You may find the already created monitoring script from the following Microsoft link or either you may write your own script. As per my understanding this script will monitor the health of Web Site and Application Pool.


Click NEXT and FINISH.

Now you will find a script resource under Cluster Service Group which created above. Open the script where you copied(in our scenario we copied the script at %WINDOWS%\system32\inetsrv).

Default Entry of Script

SITE_NAME = “Default Web Site”
APP_POOL_NAME = “DefaultAppPool”

Now if you have more Application Pools in IIS, make another generic script resource and now the second script will be like below

New Entry of Script

New entry of the script will be like as below.

SITE_NAME = “Default Web Site”
APP_POOL_NAME = “DefaultAppPool-1”
Make as much script and generic script resources as you have Application Pools.

  • Configure some changes in Cluster Configuration

In the below mentioned snap increase the value of Maximum Failures in the specified period when you are in testing face. As if the mentioned attempts exhausted, the failover will not occur. In our case we mentioned 30 attempts of failover in 1 hour for testing purpose.


In the below mentioned snap configure the value of the Cluster Resource as per your need. See the reference what we did.


As mentioned above the value 03 means that these are the attempts to restart the service in the specified time and the specified time is 10 seconds. Means under 10 seconds the service will try to restart 3 times. If the service failed to start , the service will then failover to another available cluster node. In our case the service means the Default Web Site and Application Pools mentioned in the script above.

One more thing: If you would like to reset some services(In my case sometimes I want to manually reset IIS) and you dont need to failover cluster, you can increase the time under Resources Properties=>Advance Policies=>Basic Resource Health Check Interval=>Use this time period

  • Verify Monitoring Script is working fine

– Verify the IIS Health.
– Verify the Web Site Health.
– Verify Application Pool Health.

Verify the IIS Health.

Now online the script resource under Cluster Service Group.

Query the service process ID and Kill the WWW publishing service from the below command which kill the said service and failover this service to other/passive node.

C:\Users\administrator.SCHOOL>sc queryex w3svc

TYPE               : 20  WIN32_SHARE_PROCESS
STATE              : 4  RUNNING
WIN32_EXIT_CODE    : 0  (0x0)
CHECKPOINT         : 0x0
WAIT_HINT          : 0x0
PID                : 1980
FLAGS              :

( Note: Before killing the service make both following entries to 0 under Resource=>Properties=>policies tab=> “Period for restarts and Maximum restarts in the specified period“. Else the service will start itself and the failover will not occur. So this is just a testing )

C:\Users\administrator.SCHOOL>taskkill /f /pid 1980
SUCCESS: The process with PID 1980 has been terminated.

The above commands will kill the WWW publishing service and as the WWW publishing service stopped it will also stop the Default Web Site and failure of Default Web Site (as per monitoring script) will lead failover to other/passive cluster node.

Verify the Web Site Health.

There could be a case where your WWW publishing service/IIS is started but anyhow the Default Web Site is stopped.

Lets try to stop the Default We Site.

C:\Windows\System32\inetsrv>appcmd.exe stop site “Default Web Site”

Doing the above will execute the failover.

Verify the Application Pool Health.

There could be a case where your WWW publishing service/IIS is started, Default Web Site started but some how any one Application Pool stopped mentioned in the script

Lets try to stop the Application Pool.

C:\Windows\System32\inetsrv>appcmd stop apppool / “DefaultAppPool”

Doing the above will execute the failover.

Helpful link

In the same activity I faced an issue while adding a shared disk resource under Microsoft Failover Cluster. which I resolved with the below mentioned procedure. Hope this may also help.

Posted in: Tech News