Warning : This project is out of date and will not work with the latest releases of .Net Core.

This is a project which can be found on GitHub at…


I started this project as a simple way of testing how much I recalled off the top of my head when creating an Asp.Net Core application from an empty project and is based on a project by Peter Shaw and his Microservice talk for DDD North 2015 which can be found here.


I created this project on Windows using Visual Studio 2015, but given this uses the coreclr; in theory you could get this running on Linux/Mac OS X.

The project is divided into a number of areas and each service project is designed to run on the Kestrel http server as independent processes.

The first set of projects are the web applications themselves. At the time of this writing there are three of them. The first is the ‘Microservices.Web’ project which deals with the web view. Making use of MVC the controllers for this project can be found in the ‘WebViews’ folder. The other two are the Web Apis and their controllers can be found in the ‘WebApis’ folder.

Logic is injected into the controllers and this logic is found in the ‘Logic’ solution folder. DI is setup in the startup.cs files of the web application projects. You’ll see something like this…

services.AddTransient<IGetEvents, EventData>();

At the moment only the web apis have any addition logic injected into them.

The DBContext is in the ‘Data’ solution folder with the models project and uses Entity Framework Core. The data project also contains a startup.cs so you can run this project in isolation for updating your db with migrations. Also, it’s worth noting I’m using User Secrets to hold the connection string to my db. You’ll need to configure this at your end if you wish to run the project.

How to run the Web Applications

All the projects are set to use ‘dnxcore50’ which you can see in each of their project.json files. If you haven’t installed the .Net Core and the stuff for Asp.Net Core 1 you can get started with this here…


At the time of this writing the dnx version I’m using is 1.0.0-rc1-update2 coreclr x64. If you haven’t played with AspNet Core 1 yet, you can run the web projects from a command prompt opened at the folder of the specific project using this command.

dnx web

Now, the web api projects are already setup to run from a different port to the default localhost:5000. In their project.json (I’m looking at the project.json in the ‘Microservices.ServiceOne’ project) you will find a line which looks like this…

"web": "Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:5001/"

Which sets for us the port we want this project to use. Service two is set to use 5002.

The web view project, making use of Typescript and Gulp for minifying, simply uses JQuery ajax calls pointed at the ports setup for now. I’m thinking of a more sophisticated system for this later. Making use of razor and some of the new stuff in Asp.Net Core, and if you look in the ‘_Layout.cshtml’, you’ll see the ‘asp-append-version’ being used to give us a hash of the minified js file. There’s a lot of new stuff like this in there but at the moment this project hasn’t made use of them. A very useful example of which is the loading of different JS files depending on the environment, e.g. development or production. Though as said, this will appear in the project at some later time when the beers are plentiful.

Having all three web applications running looks something like this below.



I’ve also navigated to localhost:5000 so you can see that logging is enabled and you can see stuff happening. You can also see things like SQL generated by LINQ to SQL and such like in the command prompt output; it’s very handy.

Word of warning, there’s a good chance most of this will stop working as I’ll probably be working on it after a number of beers at the weekend.