Site Restart Service

Site Restart Service

The Site Restart Service (available on the DVD within the Utilities folder) installs as a Windows service and when running acts as a Site Monitor. When a Smartsite iXperion site's application domain recycles (through code or because of a configuration file change for example), Smartsite will detect this event using an attached eventhandler and will write an event to the Windows (Application) eventlog.

AppDomain Recycle Event

This "AppDomain Recycle" event contains specific information, such as the reason causing the appdomain recycle, the site's name and location, etc.

AppDomain Recycle Event

 

The event details (when deserialized) contains even more details:

 

XML CopyCode image Copy Code
<?xml version="1.0" encoding="utf-16"?>
<eventdata>
 <sitename>Emptysix-11</sitename>
 <applicationid>/LM/W3SVC/7/ROOT</applicationid>
 <shutdownreason>ConfigurationChange</shutdownreason>
 <physicalpath>D:\SixSites\EmptySix-11\WWW\</physicalpath>
 <virtualpath>/</virtualpath>
 <shutdownmessage>IIS configuration change
  HostingEnvironment initiated shutdown
  HostingEnvironment caused shutdown</shutdownmessage>
 <shutdownstack>
   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
    at System.Environment.get_StackTrace()
    at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
    at System.Web.Hosting.HostingEnvironment.InitiateShutdown()
    at System.Web.Hosting.PipelineRuntime.StopProcessing()
   </shutdownstack>
</eventdata>

 

The Site Restart Service listens to this specific kind of events (Source="Smartsite iXperion" and Event-ID="10102") when they are added to the Event Log using an EntryWritten eventhandler. All other events are ignored.

Executing http requests

When such event (as described above) is detected, the Site Restart Service analyzes the event data and determines for which site the AppDomain recycle has occurred. It then reads the site's smartsite.config configuration file to determine the site's addresses (for both the publication engine and the cms engine).

Both these addresses are then used to execute a http request to, basically resulting in (re-)starting the site. This way, site downtime caused by an AppDomain recycle will be limited to just a couple of seconds.

Autostart Sites

Another option of the Site Restart Service, is to execute http requests to all configured Smartsite sites when the service is started. To do so, the service queries IIS for all configured sites, and for each site it checks if it's a Smartsite site. If it is, the same procedure for executing http requests as described above will be performed.

Installation

To install the Site Restart Service, copy the folder from the DVD to a local destination, e.g. Program Files\Smartsite Software. Open an .NET Framework command prompt, change the directory to the local Site Restart Service folder and run the following command:

  CopyCode image Copy Code
installutil SiteRestartService.exe

When using an standard command prompt, run the following command:

  CopyCode image Copy Code
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil SiteRestartService.exe

To uninstall, just run the same command specifying "/u" as extra parameter.

Configuration

The configuration file of the Site Restart Service (SiteRestartService.exe.config) holds a few settings with which the behavior of the service can be adjusted.

Setting Description
OnStartDelayMinutes
(Numeric)
Delay time (in minutes) before http requests are executed (after service has started).
MaxRetries
(Numeric)
Number of retries when a http request fails.
SleepIntervalBetweenRetries
(Numeric)
Sleep interval (in milliseconds) between subsequent http requests (when first request fails)
OnStartSynchronousRequests
(Boolean)
Determines if these requests should be executed synchronously (if True, one Thread at a time will be started, otherwise multiple Threads will be started).
OnStartExecuteRequests
(Boolean)
Determines if http requests should be executed when the service starts.