Running your ASPNET application from Ubuntu 14.04

March 21, 2016 by Anuraj


Ubuntu is a Debian-based Linux operating system and distribution for personal computers, smartphones and network servers. This post is about running ASP.NET Core application on Ubuntu VM running on Azure and making the application accessible via browser. First you need to install DNX runtime on the server, you can find more details about the installation from ASP.NET Docs site. You need to run the following commands as sudo in terminal.

  • First you need to install DNVM, you required .NET Version Manager (DNVM) to install different versions of the .NET Execution Environment (DNX) on Linux.
curl -sSL | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/
  • Next you need to install the .NET Execution Environment (DNX). The first command will install the prerequisites.
sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev
  • Once the prerequisites installed, you can use DNVM to install DNX for .NET Core
dnvm upgrade -r coreclr

Installation is completed. Now you can run the ‘dnvm list’ command to verify the installed runtimes. Get the samples from ASP.NET Home. Open terminal and extract the zip. Navigate to the samples directory and execute ‘dnu restore’ and ‘dnx web’ command. Here is the screenshot of the application running from terminal.

DNX Web Command running on Ubuntu Terminal

Now you can navigate to the Azure endpoints tab, and add an HTTP endpoint, public port will be 80, and private port will be the port where your ASP.NET application running, in this case private port is 5000.

Endpoint configuraion on Azure Linux VM

Now you can browse the application from your system with the URL.

Happy Programming

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub