This tutorial shows how to create the infrastructure required to host a ASP.NET web app, and how to automatically deploy that application with Farmer. We’ll cover the following steps:
Note: Your web application can be a C# web application - it does not need to be written in F#!
Create a brand new ASP.NET web application:
dotnet new mvc
.csproj
or fsproj
), the Project SDK is already set to Microsoft.NET.Sdk.Web
. This is more-or-less required for hosting in Azure.deploy
: dotnet publish -c Release -o deploy
.dotnet publish puts all built files and outputs into a single folder, and adds a
web.config
as required for e.g. Azure, as long as your Project SDK is set correctly.
Create a new Farmer application which contains a web app.
open Farmer
open Farmer.Builders
let webapplication = webApp {
name "<web app name goes here>"
}
let webapplication = webApp {
...
zip_deploy @"<path_to_your_deploy_folder>"
}
Deploy the web app by adding it to an ARM builder and deploy it to a resource group of your choosing. During the deployment process, you will notice the following:
Running ZIP deploy for <path_to_your_deploy_folder>
Farmer will automatically zip up the contents of the folder for you.