Creating an Ubuntu developer VM on Hyper-V – Part 4


We have been in the past and still are to a certain extent a .NET shop. Thus it is very important to us that we can develop our backend using ASP.NET Web API. ASP.NET vNext is now OSS and runs equally well on Windows, Linux and Mac. Well, at least that’s what the folks at Microsoft tell us. The goal of this post is to verify that we can indeed create a RESTful backend using ASP.NET vNext on Ubuntu.

Please make sure you have also read my previous posts about setting up a Ubuntu VM.

  • Creating an Ubuntu developer VM on Hyper-V 
    • Creating an Ubuntu developer VM on Hyper-V – Part 2

      Please refer here for more details. But please be aware that at the time of writing the documentation is somewhat incomplete to say the least.

      Let’s first install the K version manager (KVM). With the following command we get the KVM setup

      Note that as a prerequisite we need to have Mono 3.4.1 or later installed as described in this post.

      We can now install the latest version of KVM like this (at the time of this writing it is v 1.0.0-beta1)

      kvm upgrade

      To test the whole thing I first create a new folder and navigate to it

      mkdir ~/dev/ cd ~/dev/

      and then clone the ASP.NET Home directory from GitHub to it

      git clone

      Running the Console sample application

      We can now try to play with the samples in the Home folder. Let’s start with the simplest one, the ConsoleApp. Let’s navigate to this folder

      cd ./Home/samples/ConsoleApp

      Creating the necessary certificates

      If we try to run kpm restore now directly as described here then we get loads of errors. The reason is that the .NET Framework on Windows uses the Windows Certificates store to check whether to accept an SSL certificate from a remote site. In Mono, there is no Windows Certificate store, it has its own store. By default, it is empty and we need to manage the entries ourselves. We can do this using the following script

      Having added all those certificates to the store we can now download/restore all nuget packages required by our sample app

      kpm restore

      and then run the sample

      k run .

      which gives us


      Running the Web samples

      Running the Web samples is a bit more tricky. First of all we need kestrel, a development web server for ASP.NET vNext. At the time of writing there is an open issue with running Kestrel on Linux. Kestrel relies on libuv. To install a compatible version of libuv use the following script (that I found here)

      After all this we should be able to get our MVC and Web samples going. Navigate to the corresponding sample folder and restore the nuget packages

      kpm restore

      and then run the sample

      k kestrel

      which now should give this


      with your browser navigate to localhost:5004 and enjoy 🙂


      We can stop Kestrel by pressing CTRL-z


      Defining a REST API

      Now let’s add a simple REST API to the HelloMVC sample app. Add a file TodoController.cs to the Controllers directory and add the following code

      save and restart kestrel. In the browser navigate to http://localhost:5004/api/todo and you should see this

      image </p>

      Well, well, that’s a good start…!


      In the last four posts I have summarized all the necessary steps that are needed to setup a Ubuntu VM ready to develop Angular single page applications that are backed by either a Node JS or a .NET (Mono) backend. The backend relies on GetEventStore as a write model store and on Elastic Search and MongoDB as read model stores. Thus we are now ready to implement an end-to-end sample. This will be the topic of my next few posts. Stay tuned.

Creating an Ubuntu developer VM on Hyper-V – Part 3