Press "Enter" to skip to content

ASP.NET Core on a Pi running Win10IoT

Since the announcement of Windows 10 IoT for the Raspberry Pi, we felt the absence of a decent webserver. ASP.NET on the Pi would be marvelous, but wasn’t supported. To keep my projects going I started building my own simple web API server and created a nuget package for it (Restup). It is working quit nice, but not nearly as feature complete as ASP.NET. This week a friend of mine pointed out this GitHub page which explained how you could get the dotnet runtime going on a Win10Iot Pi. My first reaction to this post was… can I run ASP.NET Core projects? A few hours later I had it running. It’s quit a hassle to get it going, so I thought it would be a good idea to put it all into one post. Here we go!

The environment I used to get this running:

  • Using Visual Studio 2015 Update 3 (community will do fine)
  • Microsoft .NET Core Tools 14.1.20624.0 (Visual Studio extension)
  • Pi2 (3 will do fine as well) with Windows 10 IoT version 10.0.14393.0

Next is setting up the ASP.NET Core project:

  • Create ASP.NET Core project (use the Web API template)
  • Add a new file named hosting.json and change the content to:
{ "server.urls": "http://*:5100" }
  • Add hosting.json to the publishOptions/include section in project.json
  • Add the following dependencies by editing the project.json:
"System.ComponentModel.TypeConverter": {
"version": "4.3.0",
"exclude": "runtime"
"System.ComponentModel.Primitives": {
"version": "4.3.0",
"exclude": "runtime"
"System.Collections.Specialized": {
"version": "4.3.0",
"exclude": "runtime"
"System.Linq": {
"version": "4.3.0",
"exclude": "runtime"
"System.Threading": {
"version": "4.3.0",
"exclude": "runtime"
  • Edit the project.cs file and replace the Main method with:
var config = new ConfigurationBuilder()
  .AddJsonFile("hosting.json", optional: true, reloadOnChange: true)

var host = new WebHostBuilder()

  • Create a publish profile (right mouse on your project –> publish) and use the custom template (which published to a folder)
  • Publish your project
  • Open a explorer and navigate to you publish folder
  • Change the <projectname>.runtimeconfig.json, change the version of runtimeOptions/framework to: 1.2.0-beta-001291-00

Next, we have to prepare the Pi:

  • Copy the published folder to your Pi in any directory you want (e.g. c:\tmp)
  • Download and extract the dotnet for ARM (beta version) in a folder on your Pi (e.g. c:\dotnet)
  • Enter remote powershell to your Pi
  • Add the dotnet folder to the path variable with:
$env:path += ';c:\dotnet'
  • Add firewall exception for port 5100:
netsh advfirewall firewall add rule name="WebAPI test 5100" dir=in action=allow protocol=TCP localport=5100
  • CD into the folder where you copied the published webapp (my case c:\tmp) and run:
dotnet WebApplication1.dll

That’s it, peanuts right :). There are some people at Microsoft working hard to get a better user experience. I couldn’t have done this without the help of others, this GitHub issue was used to get this going. Big thanks to all the participants in that discussion. For now, enjoy you ASP.NET Core application on you Raspberry Pi running Windows 10 IoT by browsing to: