# Application restart

## Application restart during development

Sitefinity CMS API exposes several overloaded methods, which you can use to trigger a restart of your Sitefinity CMS application. To do a restart, you can use the following code:

```C#
using Telerik.Sitefinity.Services;

namespace SitefinityWebApp
{
   public class RestartApplication
   {
       public void RestartSitefinityApplication()
       {
           SystemManager.RestartApplication("Restart invoked through the Sitefinity CMS API", SystemRestartFlags.Default, true);
       }
   }
}
```

In the code above you initiate an application restart by calling the `RestartApplication()` method of the `SystemManager` class. You can specify the restart reason, the type of restart you want to perform, and whether or not to send the restart application system message.

Using `SystemRestartFlags` enumeration, you specify the type of restart. It has the following values:

* `Default`\
  Cleans the application cache and reinitializes the system.
* `AttemptFullRestart`\
  Unloads the application from the application domain.
* `ResetModel`\
  Resets the database model by forcing the metadata containers for each opened connection to be recreated.

## Configure the application restart behavior during uploads

When you upload `dll` files on a live website, during the copying and pasting, the website is restarted several times, but the application pool is not recycled. Because the site is public, each one of those restarts is waiting for the whole site startup procedure. To prevent multiple website restarts during `dll` files upload you must change the following setting in your `web.config` file:

```XML
<configuration>
  <system.web>
    <httpRuntime waitChangeNotification="60" maxWaitChangeNotification="60" />
  </system.web>
</configuration>
```

The `waitChangeNotification` and `maxWaitChangeNotification` values are in seconds and must be higher than the total time taken by the copy - paste procedure in seconds. This can speed up the time that it takes for the site to load after upload.

The following diagram explains the basics of how an ASP.NET site is hosted in the `w3wp.exe` process:

[![](https://www.progress.com/documentation/sitefinity-cms/assets/6c9009ccdfa9fb6bd6195a7b3c8eeb83/w3w.png "w3w")](https://www.progress.com/documentation/sitefinity-cms/assets/6c9009ccdfa9fb6bd6195a7b3c8eeb83/w3w.png)

For more information, see [HttpRuntimeSection.WaitChangeNotification Property](https://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.waitchangenotification.aspx) and [HttpRuntimeSection.MaxWaitChangeNotification Property](https://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxwaitchangenotification.aspx)
