I have a complex server application that uses Nhibernate and Linq2SQL. About 3 times per day the Linq2sql code generates a \"value cannot be null\" exception. Once this happ
The following code will recycle the current site's app pool. You need to add a reference to Microsoft.Web.Administration
using (ServerManager iisManager = new ServerManager())
{
SiteCollection sites = iisManager.Sites;
foreach (Site site in sites)
{
if (site.Name == HostingEnvironment.SiteName)
{
iisManager.ApplicationPools[site.Applications["/"].ApplicationPoolName].Recycle();
break;
}
}
}