Skip to content

michael-wolfenden/Cake.IIS

 
 

Repository files navigation

Cake.IIS

Cake-Build addin that extends Cake with IIS extensions

Build status

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Implemented functionality

  • Create Website / Ftpsite
  • Delete Site
  • Start Site
  • Stop Site
  • Site Exists
  • Create Applicaiton Pool
  • Delete Pool
  • Start Pool
  • Stop Pool
  • Pool Exists
  • Recycle Pool
  • Create WebFarm
  • Delete WebFarm
  • Add server to WebFarm
  • Delete server from WebFarm
  • Server exists
  • Set server Healthy
  • Set server Unhealthy
  • Set server Available
  • Set server Unavailable
  • Is server Healthly
  • Get server State

Referencing

Cake.IIS is available as a nuget package from the package manager console:

Install-Package Cake.IIS

or directly in your build script via a cake addin:

#addin "Cake.IIS"

Usage

#addin "Cake.IIS"


Task("ApplicationPool-Create")
    .Description("Create a ApplicationPool")
    .Does(() =>
{
    CreatePool("remote-server-name", new ApplicationPoolSettings()
    {
        Name = "Production",

        Username = "Admin",
        Password = "pass1"
    });
});

Task("ApplicationPool-Stop")
    .Description("Stops a local ApplicationPool")
    .Does(() =>
{
    StopPool("Production");
});

Task("ApplicationPool-Start")
    .Description("Starts a remote ApplicationPool")
    .Does(() =>
{
    StartPool("remote-server-name", "Production");
});



Task("Website-Create")
    .Description("Create a Website")
    .Does(() =>
{
    CreateWebsite("remote-server-name", new WebsiteSettings()
    {
        Name = "MyBlog",
        HostName = "blog.website.com",
        PhysicalDirectory = "C:/Websites/Blog",

        ApplicationPool = new ApplicationPoolSettings()
        {
            Name = "Production"
        }
    });
});

Task("Website-Stop")
    .Description("Stops a remote Website")
    .Does(() =>
{
    StopSite("remote-server-name", "MyBlog");
});

Task("Website-Start")
    .Description("Starts a local Website")
    .Does(() =>
{
    StartSite("MyBlog");
});



Task("WebFarm-Create")
    .Description("Create a WebFarm")
    .Does(() =>
{
    CreateWebFarm("remote-server-name", new WebFarmSettings()
    {
        Name = "Batman",
        Servers = new string[] { "Gotham", "Metroplis" }
    });
});

Task("WebFarm-Server-Available")
    .Description("Sets a WebFarm server as available")
    .Does(() =>
{
    SetServerAvailable("remote-server-name", "Batman", "Gotham");
});

Task("WebFarm-Server-Unavailable")
    .Description("Sets a WebFarm server as unavailable")
    .Does(() =>
{
    SetServerUnavailable("remote-server-name", "Batman", "Gotham");
});


RunTarget("Website-Create");

Example

A complete Cake example can be found here

TroubleShooting

A few pointers for managing IIS can be found here

Releases

No releases published

Packages

No packages published

Languages

  • C# 95.7%
  • PowerShell 4.1%
  • Batchfile 0.2%