FAKE.IIS

FAKE.IIS provides extensions around the Microsoft.Web.Administration library to provide clean interfaces to easily configure IIS Sites and Application Pools.

Installing

FAKE.IIS is a separate package that can be installed from NuGet.

PM> Install-Package FAKE.IIS

Creating a ApplicationPool and Site

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
#r "Fake.IIS.dll"
#r "Microsoft.Web.Administration.dll"

open Fake.IISHelper

let siteName = "fake.site"
let appPoolName = "fake.appPool"
let port = ":80:"
let path =  @"C:\inetpub\wwwroot"

let siteConfig = SiteConfig(siteName, port, path, appPoolName)
let appPoolConfig = ApplicationPoolConfig(appPoolName)

(IIS
  (Site siteConfig)
  (ApplicationPool appPoolConfig)
  (None))

Deleting an Application Pool and Site

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
#r "Fake.IIS.dll"

open Fake.IISHelper

let siteName = "fake.site"
let appPoolName = "fake.appPool"

deleteSite siteName
deleteApplicationPool appPoolName
val siteName : string
val appPoolName : string
val port : string
val path : string
val siteConfig : obj
val appPoolConfig : obj
union case Option.None: Option<'T>