Skip to content

DrKoch/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

Table of contents

  1. Implemented functionality
  2. Referencing
  3. Usage
  4. Example
  5. TroubleShooting
  6. Plays well with
  7. License
  8. Share the love

Implemented functionality

  • Create Website / Ftpsite
  • Delete Site
  • Start Site
  • Stop Site
  • Site Exists
  • Create Application 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 Healthy
  • Get server State

Referencing

NuGet Version NuGet Downloads

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.

Plays well with

If your looking to deploy to IIS its worth checking out Cake.WebDeploy or if your running a WebFarm inside AWS then check out Cake.AWS.ElasticLoadBalancing.

If your looking for a way to trigger cake tasks based on windows events or at scheduled intervals then check out CakeBoss.

License

Copyright (c) 2015 - 2016 Sergio Silveira, Phillip Sharpe

Cake.IIS is provided as-is under the MIT license. For more information see LICENSE.

Share the love

If this project helps you in anyway then please ⭐ the repository.

Releases

No releases published

Packages

No packages published

Languages

  • C# 95.3%
  • PowerShell 4.6%
  • Batchfile 0.1%