Use the maintenance web

The Zervicepoint Maintenance Web is a simple website used during maintenance work such as upgrading Zervicepoint.

This article describes how to switch between Zervicepoint UserWeb/AdminWeb and MaintenanceWeb using three different scenarios.

Scenario 1: Stopping and starting sites

In this scenario the maintenance web is installed on the same machine where userweb and adminweb are installed. This is the default setting. You should use this scenario only if you are not planning to stop IIS during maintenance, for instance during a normal upgrade.

When maintenance web is installed it is bound to port 443 and 20000 to allow it to respond to userweb and adminweb requests. Because it uses the same ports it cannot be started while userweb and/or adminweb is running. To start it you must first stop userweb and adminweb.

To manually switch to maintenance web, start Internet Information Services (IIS) Manager, expand "Sites", select "ZervicePoint UserWeb" and click "Stop" in the "Actions" pane. Then do the same with "ZervicePoint AdminWeb". Finally select "ZervicePoint MaintenanceWeb" and click "Start" in the "Actions" pane. After maintenance switch back to userweb/adminweb by first stopping "ZervicePoint MaintenanceWeb" and then starting userweb/adminweb.

You can automate switching to mainenance web by creating a Powershell script with the following commands:

Import-Module WebAdministration
Stop-Website -Name "ZervicePoint UserWeb"
Stop-Website -Name "ZervicePoint AdminWeb"
Start-Website -Name "ZervicePoint MaintenanceWeb"

To switch back after maintenance use the following commands:

Import-Module WebAdministration
Stop-Website -Name "ZervicePoint MaintenanceWeb"
Start-Website -Name "ZervicePoint UserWeb"
Start-Website -Name "ZervicePoint AdminWeb"

Scenario 2: Using IIS redirection

In this scenario maintenance web is installed on a different machine from the one where userweb and adminweb are installed and you are using HTTP Redirect or URL Rewrite to route requests to the maintenance web. You should use this scenario only if you are not planning to stop IIS during maintenance, for instance during a normal upgrade.

You can install maintenance web alone on a separate machine by using the same Install.cmd file but modifying the IncludeComponents variable to include only MaintenanceWeb as in the example below.

SET IncludeComponents=MaintenanceWeb

To switch from userweb/adminweb to maintenanceweb you can use any of the following methods:

Method 1: Using HTTP Redirect

To manually switch to maintenance web using HTTP Redirect, start Internet Information Services (IIS) Manager, expand "Sites", select "ZervicePoint UserWeb" and double-click "HTTP Redirect" under "IIS" in the "Features" view. Then check the "Redirect requests to this destination" checkbox, enter the URL to the maintenance web and check the "Redirect all requests to exact destination" checkbox. Repeat this for the "ZervicePoint AdminWeb" site.

You can automate switching to maintenance web using HTTP Redirect by creating a Powershell script with the following commands:

$maintenanceWebUrl = "<replace with url to your maintenance web>"
Import-Module WebAdministration
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\ZervicePoint UserWeb" -Value @{ enabled="true"; destination="$maintenanceWebUrl"; exactDestination="true"; httpResponseStatus="Found" }
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\ZervicePoint AdminWeb" -Value @{ enabled="true"; destination="$maintenanceWebUrl"; exactDestination="true"; httpResponseStatus="Found" }

To switch back after maintenance use the following commands:

Import-Module WebAdministration
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\ZervicePoint UserWeb" -Value @{ enabled="false" }
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\ZervicePoint AdminWeb" -Value @{ enabled="false" }

Method 2: Using URL Rewrite with a Redirect rule

To manually switch to maintenance web using URL Rewrite, start Internet Information Services (IIS) Manager, expand "Sites", select "ZervicePoint UserWeb" and double-click "URL Rewrite" under "IIS" in the "Features" view. Then click "Add rule(s)..." in the "Actions" pane. Select "Blank rule" under "Inbound rules" in the "Add Rule(s)" dialog. Enter a name for your rule, use "(.*)" as a pattern (matches anything) and in the "Action" section select action type "Redirect", enter the URL to the maintenance web and uncheck the "Append query string" checkbox. Finally click "Apply" in the "Actions" pane to save the rule. Repeat this for the "ZervicePoint AdminWeb" site.

You can automate switching to maintenance web using URL Rewrite by creating a Powershell script with the following commands:

$maintenanceWebUrl = "<replace with url to your maintenance web>"
Import-Module WebAdministration
$filterRoot = "system.webServer/rewrite/rules/rule[@name='Maintenance']"
$userWeb = "IIS:\sites\ZervicePoint UserWeb"
$adminWeb = "IIS:\sites\ZervicePoint AdminWeb"
Add-WebConfigurationProperty -PSPath $userWeb -Filter "system.webServer/rewrite/rules" -Name "." -Value @{ name='Maintenance'; patternSyntax='Regular Expressions'; stopProcessing='true' }
Set-WebConfigurationProperty -PSPath $userWeb -Filter "$filterRoot/match" -Name "url" -Value "(.*)"
Set-WebConfigurationProperty -PSPath $userWeb -Filter "$filterRoot/conditions" -Name "logicalGrouping" -Value "MatchAny"
Set-WebConfigurationProperty -PSPath $userWeb -Filter "$filterRoot/action" -Name "type" -Value "Redirect"
Set-WebConfigurationProperty -PSPath $userWeb -Filter "$filterRoot/action" -Name "url" -Value "$maintenanceWebUrl"
Set-WebConfigurationProperty -PSPath $userWeb -Filter "$filterRoot/action" -Name "appendQueryString" -Value "false"
Set-WebConfigurationProperty -PSPath $userWeb -Filter "$filterRoot/action" -Name "redirectType" -Value "Found"
Add-WebConfigurationProperty -PSPath $adminWeb -Filter "system.webServer/rewrite/rules" -Name "." -Value @{ name='Maintenance'; patternSyntax='Regular Expressions'; stopProcessing='true' }
Set-WebConfigurationProperty -PSPath $adminWeb -Filter "$filterRoot/match" -Name "url" -Value "(.*)"
Set-WebConfigurationProperty -PSPath $adminWeb -Filter "$filterRoot/conditions" -Name "logicalGrouping" -Value "MatchAny"
Set-WebConfigurationProperty -PSPath $adminWeb -Filter "$filterRoot/action" -Name "type" -Value "Redirect"
Set-WebConfigurationProperty -PSPath $adminWeb -Filter "$filterRoot/action" -Name "url" -Value "$maintenanceWebUrl"
Set-WebConfigurationProperty -PSPath $adminWeb -Filter "$filterRoot/action" -Name "appendQueryString" -Value "false"
Set-WebConfigurationProperty -PSPath $adminWeb -Filter "$filterRoot/action" -Name "redirectType" -Value "Found"

To switch back after maintenance use the following commands:

Import-Module WebAdministration
Clear-WebConfiguration -PSPath "IIS:\sites\ZervicePoint UserWeb" -Filter "system.webServer/rewrite/rules/rule[@name='Maintenance']"
Clear-WebConfiguration -PSPath "IIS:\sites\ZervicePoint AdminWeb" -Filter "system.webServer/rewrite/rules/rule[@name='Maintenance']"

Scenario 3: Using DNS

In this scenario maintenance web is installed on a different machine from the one where userweb and adminweb are installed and you are using DNS to route requests to maintenance web. You should use this scenario when you are planning to stop Internet Information Services (IIS) on the machine hosting the Zervicepoint webs.

You can install maintenance web alone on a separate machine by using the same Install.cmd file but modifying the IncludeComponents variable to include only MaintenanceWeb as in the example below.

SET IncludeComponents=MaintenanceWeb

To switch from userweb/adminweb to maintenanceweb using DNS, simply create a CNAME (alias) record mapping the URL of your Zervicepoint web to the URL of the maintenance web site.