In a previous post I showed you how to install the .Net Core 2.0 on a Raspberry Pi running Raspbian so that you could run dotnet Core applications on this wonderful device.  We didn't really run any applications in the previous post but we did prove that the dotnet core was installed properly.  In this post I will walk you through creating an ASP.Net Core 2.0 Hello World Web Application and deploy it onto the Raspberry Pi.  You will create this project on your developer machine and target the ARM processor for deployment to a Raspberry Pi.  This post will only cover doing this on a Windows machine.


You are going to need to make sure you have the .Net Core SDK on your developer workstation before you write some code.  Well I don't need to show you how to do that on my blog as it has already been done here. So stop procrastinating and get it installed.

Just to double check that the .Net Core 2.0 SDK is installed open up a comman prompt and execute the following:

dotnet --info

You should see something like the following output:


Create the Web App

Back on your developer workstation in that CMD prompt, create a new directory to hold your web application.

 mkdir hello-world

Then jump into that new directory.

 cd hello-world

Then create a new web application.

 dotnet new web

This created a simple web application that we can test on our developer workstation to make sure it works.

dotnet run

You should see something like the following output:


Go ahead I know you are dying to open up a browser and navigate to http://localhost:5000 and see this new start of the art application!

You should see something like the following:


Ok this is pretty bare bones but I did say we were going to create a hello world web application.  But wait the real fun part is getting this to run on the Raspberry Pi. Go ahead and kill the development web server in the CMD prompt using Ctrl+C.  First we need to change the code so that it will bind to more IP addresses then the localhost one.  Edit the Program.cs class and change the following to add the UseKestrel and telling the web server to listen on all IP Addresses:

       public static IWebHost BuildWebHost(string[] args) =>
                .UseKestrel(options =>

Now lets publish this web application to a linux ARM platform.

dotnet publish -r linux-arm

The output of this commend looks something like this:


This command generated all the files you need to copy over to the Raspberry Pi.  This is where you need to figure out the best way to copy the files to the Raspberry Pi.  One way to do this is to run an FTP server on the Pi and open up a FTP client (such as FileZilla) on your developer workstation and upload the files.  I like to use the Python library called pyftpdlib as it allows you to serve up files in any folder on the Pi and it is a temporary FTP server.  I didn't really want to focus this post on setting up an FTP server so I thought using this library will be the path of least resistance.  I am going to assume you already know how to SSH into your Raspberry Pi with something like Putty so go ahead and do that.

On the Raspberry Pi install the python FTP library.

pip install pyftpdlib

Once the library is installed you need create a folder on the Raspberry Pi that will hold the hello-world web application.  On the Raspberry Pi issue the follwoing command:

mkdir hello-world

Then navigate into that directory

cd hello-world

Then start up the FTP server so we can upload the files.  On the Raspberry Pi execute the following command.

python -m pyftpdlib -w

On your developer workstation start up your favorite FTP client (such as FillZilla) and connect to the Raspberry Pi using anonymous/anonymous as the useranme/password.  Upload the files located in bin\debug\netcoreapp2.0\linux-arm\publish folder to the Raspberry Pi.

Once the files are uploaded you can stop the FTP server on the Pi by using Ctrl+C in the SHH terminal. Next we need to set the right permissions on the executable.  Execute the follwing command on the Raspberry Pi.

chmod 755 hello-world

Now lets execute the application to serve up the files, so execute the following on teh Raspberry Pi:


The program should start up and let you know the port it is serving the web site on.

Open up a browser on your developer workstation and put in http://x.x.x.x:5000 where x.x.x.x is the IP address of your Raspberry Pi. You should see the hello-world web application in your browser.


As you can see it is pretty easy to create a web application on your development machine and target the linux-arm platform so that the application can be copied over to the Raspberry Pi and executed.  We only did a simple web application but you can also create an mvc application and expose a Web API from the Pi.  Just execute the following:

dotnet new mvc

Next up I will look into remotely debugging an application from your developer workstation on the Raspberry Pi.


I just started playing around with .Net Core since it has hit the 2.0 release.  Since I have used Raspberry Pi’s on many projects I thought it was time to do a hello world Asp.Net Core project that is served up on a Raspberry Pi using Raspbian for the OS.  Here is how I got that going.

My goal was to create the default out of the box ASP.Net Core MVC application on my Windows 10 developer machine and publish it targeting ARM and see if I could get that running on the Raspberry Pi.  I do not intend to compile applications on the Raspberry Pi as I believe that would just be slow going.  I have longer term goals like being able to debug on the Pi from my Dev machine but lets take baby steps first.

Setting up the Raspberry Pi

At the time of writing this post it wasn’t real clear to me how to get .Net Core running on my Raspberry Pi with the latest Raspbian OS.  On the Dotnet Core Docs site, there were instructions that targeted specific Linux distros but nothing that I saw specifically for Raspbian.  However I did find another blog post by Jeremy Lindsay that got me to the point that .Net Core 2 was installed on my Raspberry Pi.  I am not going to go into deep details on how to get Raspbian installed and how you shell into a terminal on a linux box as that is covered on many other posts (including Jeremy’s).

Run the following commands in a terminal window on the Raspberry Pi:

# Update the Raspbian Jessie install 
sudo apt-get -y update 

# Install the packages necessary for .NET Core 
sudo apt-get -y install libunwind8 gettext 

# Download the nightly binaries for .NET Core 2 
wget https://dotnetcli.blob.core.windows.net/dotnet/Runtime/release/2.0.0/dotnet-runtime-latest-linux-arm.tar.gz

# Create a folder to hold the .NET Core 2 installation 
sudo mkdir /opt/dotnet 

# Unzip the dotnet zip into the dotnet installation folder 
sudo tar -xvf dotnet-runtime-latest-linux-arm.tar.gz -C /opt/dotnet 

# set up a symbolic link to a directory on the path so we can call dotnet 
sudo ln -s /opt/dotnet/dotnet /usr/local/bin 

At this point you should be able to test the install by executing the following in a terminal window on the Raspberry Pi:

dotnet --info

And you should get something back that tells you what version on dotnet core you have.



As you can see getting the .Net Core 2 on your Raspberry Pi is pretty easy.  Next post I will go into creating an MVC hello world app and running it on the Raspberry Pi.

I kicked off another Halloween project this year and I posted it on GitHub for everyone to see and use if they like.  This project has focused around building smart devices that are all connected via an MQTT bus.  I wanted to have something that I could build on every year.  The devices are either actuators or sensors that are smart enough to serve a purpose and can be orchestrated into a bigger animation scene using a workflow engine such as Node-red.  Anyways check out the project on Hackster.io and GitHub.