Create you first ASP.NET Core App and host it in a Linux Docker container on Microsoft Azure (Part 1/3)
As most of you are probably already aware of .NET Core is the new lightweight open-source cross-platform development framework built by the .NET team. With .NET Core you can build applications that run on operating systems like Linux, Windows and MacOS as well as on the cloud. This is especially interesting for web applications that you can build with ASP.NET Core.
In this blog post that I will split into 3 parts I would like to show you how easy it is to create your first ASP.NET Core application on the command line, then host it in a Linux based Docker container and then publish this container to Microsoft Azure.
Part 1: Create you first ASP.NET Core Application
Download .NET Core SDK and command line tools for Windows, Linux oder Mac from https://www.microsoft.com/net/core
Open your command line / terminal to create your first ASP.NET Application:
dotnet new -t web
The type web (-t web) will create a ASP.NET Core MVC template web application. You can of course also use just "dotnet new" to create a basic .NET application and add everything necessary for a ASP.NET Core application yourself.
Do a package restore to get all required packages for your template application from NuGet:
Build and run you application (you can of course just build your application with "dotnet build"):
You can now see your application running locally on http://localhost:5000
Stop your local web server (Ctrl + C on Windows) and publish your application in release configuration:
dotnet publish -c Release
You can check if publishing worked correctly by changing to the "bin\Release\netcoreapp1.1\publish" folder of your project and start your app with "dotnet yourappname.dll". I had to first install Gulp globally on my machine as it is used to build the template application (npm install -g gulp).
In the next blog post we will take our application, build a Docker image with it and host it in a Docker container. You can find Part 2 here.