Cake-Build addin that extends Cake with IIS extensions
- Implemented functionality
- Referencing
- Usage
- Example
- TroubleShooting
- Plays well with
- License
- Share the love
- Create Website / Ftpsite
- Delete Site
- Start Site
- Stop Site
- Site Exists
- Add site binding
- Remove site binding
- Create Application Pool
- Delete Pool
- Start Pool
- Stop Pool
- Pool Exists
- Recycle Pool
- Create site applications
- 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
- Create Virtual Directory
- Delete Virtual Directory
- Virtual Directory Exists
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 directive:
#addin "Cake.IIS"
#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("Binding-Add")
.Description("Adds a binding to a website")
.Does(() =>
{
AddBinding("MyBlog", new BindingSettings(BindingProtocol.Http)
{
HostName = "myblog.com"
});
});
Task("Binding-Add-Fluent")
.Description("Adds a binding to a website using a fluent interface")
.Does(() =>
{
AddBinding("remote-server-name", "MyBlog", IISBindings.Http
.SetIpAddress("127.0.0.1")
.SetPort(8080));
});
Task("Binding-Remove")
.Description("Removes a binding from a website")
.Does(() =>
{
RemoveBinding("remote-server-name", "MyBlog", new BindingSettings(BindingProtocol.Http)
{
HostName = "myblog.com"
});
});
Task("Application-Create")
.Description("Adds an application to a site")
.Does(() =>
{
AddSiteApplication(new ApplicationSettings()
{
SiteName = "Default Website",
ApplicationPath = "/NestedApp",
PhysicalDirectory = "C:/Apps/KillerApp/"
});
});
Task("Application-Remove")
.Description("Remove an application from a site")
.Does(() =>
{
RemoveSiteApplication(new ApplicationSettings()
{
SiteName = "Default Website",
ApplicationPath = "/NestedApp",
PhysicalDirectory = "C:/Apps/KillerApp/"
});
});
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");
});
Task("VirtualDirectory-Create")
.Description("Creates a Virtual Directory")
.Does(() =>
{
AddSiteVirtualDirectory("remote-server-name", new VirtualDirectorySettings(){
PhysicalDirectory = "C:/Apps/Directory/",
SiteName = "Default Website",
ApplicationPath = "/",
Path = "/Directory"
});
});
Task("VirtualDirectory-Remove")
.Description("Removes a Virtual Directory")
.Does(() =>
{
RemoveSiteVirtualDirectory("remote-server-name", new VirtualDirectorySettings(){
SiteName = "Default Website",
ApplicationPath = "/",
Path = "/Directory"
});
});
Task("VirtualDirectory-Exists")
.Description("Checks if a Virtual Directory exists")
.Does(() =>
{
SiteVirtualDirectoryExists("remote-server-name", new VirtualDirectorySettings(){
SiteName = "Default Website",
ApplicationPath = "/",
Path = "/Directory"
});
});
RunTarget("Website-Create");
A complete Cake example can be found here.
A few pointers for managing IIS can be found here.
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.
Copyright (c) 2015 - 2016 Sergio Silveira, Phillip Sharpe
Cake.IIS is provided as-is under the MIT license. For more information see LICENSE.
If this project helps you in anyway then please ⭐ the repository.