How to list all IIS applicationpools and properties, with C#

/// <summary> /// List all properties of an IIS applicationpool /// </summary> /// <param name=”serverName”>Name of the IIS server e.g. localhost</param> /// <param name=”appPoolName”>Name of the applicationpool e.g. test</param> public void ListAppPoolProperties(string serverName, string appPoolName) { if (string.IsNullOrEmpty(serverName)) { throw new Exception(“Parameter [serverName] can’t be null or empty”); } if …

How to determine if an IIS website contains virtualdirectories, with C#

/// <summary> /// Does the given IIS website contain virtualdirectories. /// </summary> /// <returns></returns> public bool DoesWebsiteContainVirtualDirectories(string website) { if (string.IsNullOrEmpty(website)) { throw new Exception(“Parameter [website] can’t be null or empty”); } bool result = false; DirectoryEntry w3svc = new DirectoryEntry(“IIS://localhost/w3svc”); foreach (DirectoryEntry site in w3svc.Children) { if (site.Properties[“ServerComment”] != …

List all properties of a IIS website, with C#

/// <summary> /// List all properties of a IIS website /// </summary> /// <param name=”serverName”>Name of the IIS server e.g. localhost</param> /// <param name=”websiteName”>Name of the website e.g. test</param> public void ListWebsiteProperties(string serverName, string websiteName) { if (string.IsNullOrEmpty(serverName)) { throw new Exception(“Parameter [serverName] can’t be null or empty”); } if …

Get or set the filesystem folder (path) for a IIS website, with C#

/// <summary> /// Get the filesystem folder for the given website /// </summary> /// <param name=”serverName”>Name of the IIS server e.g. localhost</param> /// <param name=”websiteName”>Name of the website e.g. test</param> /// <returns>filesystem folder or empty if not found</returns> public string GetWebSiteFileSystemFolder(string serverName, string websiteName) { if (string.IsNullOrEmpty(serverName)) { throw new …

Get IIS website id on website name, with C#

/// <summary> /// Get website id on websitename /// </summary> /// <param name=”serverName”>Name of the IIS server e.g. localhost</param> /// <param name=”websiteName”>Name of the website e.g. test</param> /// <returns> /// Less the 0, site does not exist /// Id of the existing site /// </returns> public int GetWebSiteId(string serverName, string …

Check if an IIS website exists with C#

/// <summary> /// Check if a website on the given server exist. /// Check on websitename (ServerComment) is case insensitive. /// </summary> /// <param name=”serverName”>Name of the IIS server e.g. localhost</param> /// <param name=”websiteName”>Name of the website e.g. test</param> /// <returns></returns> public bool DoesWebsiteExist(string serverName, string websiteName) { bool result …

NANT: Build Microsoft VisualStudio solutions and configure environments

I use NANT to build Microsoft VisualStudio solutions and after deploying software with msi packages, I use NANT to configure the environment (Creating WebSite, Virtual Directories, Custom Eventlogs, register services, create folders, create shares etc) More information on NANT can be found, here: http://nantcontrib.sourceforge.net/, including documentation for task, types and …