public WebSiteData GetInfo()
        {
            InternetInformationServer iis = new InternetInformationServer();
            WebSite webSite = iis.GetWebSite(_siteName);

            if (webSite == null)
                return null;

            var siteData = new WebSiteData();
            var dirSettings = webSite.DirectorySettings;
            siteData.AppPoolName = (string)dirSettings.GetInstance(dirSettings.Path).GetPropertyValue("AppPoolId");
            siteData.PhysicalPath = (string)dirSettings.GetInstance(dirSettings.Path).GetPropertyValue("Path");
            siteData.SiteStarted = webSite.CurrentState == ServerState.Started;
            siteData.AppPoolStarted = true;

            return siteData;
        }
 public void StopAppPool()
 {
     InternetInformationServer iis = new InternetInformationServer();
     WebSite webSite = iis.GetWebSite(_siteName);
     webSite.Stop();
 }