Running ASP .NET vNext on a pcDuino

Microsoft is doing a lot of great things at the moment.  One of these is the ability to run ASP .NET vNext away from a Windows Server, and away from IIS.    Being a ASP .NET Mvc developer for a few years now, the idea to run on any environment is quite liberating.

 

A pcDuino is a device with tons of potential.   It’s a powerful device and it really is a full “mini PC” with enough processing power to do interesting things like image processing.    But is small enough to be used in situations where you would uses an Arduino, Netduino, RFduino etc in the IoT or maker space.   The pcDuino also has an Ethernet port and on-board WiFi, so it is a rather compelling internet connected device.

Having deployed Mono on my board already, it was also a no brainer to extend that and to explore the potential of an internet connected device but leveraging ASP .NET vNext to do that.

 

asp net web server

ASP .NET Web Server (with Arduino Uno and Xamarin Monkey used for scale)

 

 

To get started read these two blog posts:

 

Now that we have both Ubuntu and Mono installed, we can now begin getting ASP .NET vNext up and running.

To figure out how to do this, I referred to the ASP .NET github repository, “Getting Started” page.  This page can be found here:  https://github.com/aspnet/Home

 

Lets start by installing the necessary certificates.

$ CERTMGR=/usr/local/bin/certmgr
$ sudo $CERTMGR -ssl -m https://go.microsoft.com
$ sudo $CERTMGR -ssl -m https://nugetgallery.blob.core.windows.net
$ sudo $CERTMGR -ssl -m https://nuget.org
$ sudo $CERTMGR -ssl -m https://www.myget.org/F/aspnetvnext/
$ mozroots --import --sync

 

We need curl, so install that next

$ sudo apt-get install curl

 

Download and execute the KVM installer on the ASP .NET site.   As of writing this,  the master branch has the 1.0.0-beta1, so we will use that.

$ curl https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.sh | sh && source ~/.kre/kvm/kvm.sh
$ kvm upgrade

 

Check to see if the installation is correct, you should see the version number reflected with the list command.

$ kvm list

 

If git is not already installed, install git next.

$ sudo apt-get-install git

 

The web server ASP .NET vNext uses (Kestrel), is based on Libuv, so we need to install that next.

$ git clone https://github.com/libuv/libuv.git
$ cd libuv
$ sh autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install

 

Now we need something to run.  Lets use one of the samples from the ASP .NET github repository.for simplicity.  Clone the aspnet repository.

$ git clone https://github.com/aspnet/Home

 

Focusing on the Mvc example, change to the directory “HelloMvc”.    To resolve and download the necessary dependencies for the project, execute a restore command on the package manager “KPM”.

$ cd Home/samples/HelloMvc
$ kpm restore

 

We need to set up a symbolic link for libuv to avoid any “Object Reference not set to an instance of an object” errors.    This is not the most helpful or informative of error messages, but we get what it means.

 $ ln /usr/local/lib/libuv.so -sf ~/.kpm/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta1/native/darwin/universal/libuv.dylib

 

Run the Kestrel server

$ LD_LIBRARY_PATH=/usr/local/lib k kestrel

 

If all goes well you should see “Started” appear on the command line.

$ Started

 

The default port for kestrel is 5004.   As a test navigate to “http://localhost:5004” using the internal pcDuino Chromium browser.     The sample ASP .NET Mvc application should appear as below.

 asp .net vnextAsp .NET Mvc site up and running on Mono 3.12.0

 

Find the ip address of the pcDuino using the ifconfig command.

$ ifconfig

 

Use this ip address from a remote device (or pc’s) browser.   The great feature of the pcDuino that it is equipped with both an Ethernet port and WiFi so connectivity is very easy and convenient.

 

Congratulations you now have a Mono / NET powered IOT device running ASP .Net vNext!   A mobile wireless web server / web connected device has endless potential.   In future blog posts I hope to explore some of those.

 

I hope this was helpful!

FacebookTwitterGoogle+LinkedIn

Getting Started with a pcDuino

This is a brief introduction to the pcDuino.    I personally love it.  It’s a very compact, high performance device but with compatibility with arduino shields.   This is great for IOT use cases where more performance (or you could say intelligence) is needed.   The applications for this is endless and I hope to be exploring many of those in blogs to come.

Today I will just start with getting to know the pcDuino, and will take baby steps and we will begin with installing Ubuntu on it.  Out of interest, the pcDuino can also run Android 4.2.

 

PcDuino

 

As the picture shows, the pcDuino is nice and compact, but has all the features you could want on a device.  Having said that, there is only 1 Type A USB port.   I suggest as per my photo, to use a USB hub at-least to get everything up and running.  Many thanks to ‘O’Reilley’ for mine! 🙂   I am using a USB thumb drive, but to save a port a micro SD card could also be used.   There is a SD card slot under the board next to the audio connector.

 

Overview (as per www.pcduino.com)

pcDuino3 is a high performance, cost effective single board computer. It runs operation systems such as Ubuntu Linux and Android. pcDuino3 has HDMI interface to output its graphic desktop screen. It could support multi-format 1080p 60fps video decoder and 1080p 30fps H.264 and MPEG4 video encoder with its built-in hardware video processing engine. It targets specially the fast growing demands from the open source community. pcDuino3 provides easy-to-use tool chains and is compatible with the popular Arduino ecosystem such as Arduino Shields.

Features & Highlights:

  • 100% compatible with original Arduino Shields
  • 100% compatible with Linux and Android
  • Further support for:
  • C, C ++ with GNU tool
  • Java with standard Android SDK Python
  • Arduino pin header, Aduino UNO Slots: 14x GPIO, 2x PW M, 6x ADC, 1x UART, 1xSPI, 1x I2C
  • Ethernet 10M/100Mbps, WiFi, SATA

 

Below is the specs for the pcDuino 3 and 3B.   I will be using a 3B in this post.

 

CPU AllWinner A20 SoC, 1GHz ARM Cortex A7 Dual Core AllWinner A20 SoC, 1GHz ARM Cortex A7 Dual Core
GPU OpenGL ES2.0, OpenVG 1.1, Mali 400 Dual Core OpenGL ES2.0, OpenVG 1.1, Mali 400 Dual Core
DRAM 1GB 1GB
Onboard Storage 4GB Flash, microSD card (TF) slot for up to 32GB 4GB Flash, microSD card (TF) slot for up to 32GB
Video Output HDMI 1.4 with HDCP support HDMI 1.4 with HDCP support
OS
  • Ubuntu 12.04
  • Android 4.2
  • Ubuntu 12.04
  • Android 4.2
Arduino extension interface Arduino sockets, same as Arduino UNO
14xGPIO, 2xPWM, 6xADC, 1xUART, 1xSPI, 1xI2C
Arduino sockets, same as Arduino UNO
14xGPIO, 2xPWM, 6xADC, 1xUART, 1xSPI, 1xI2C
Network interface
  • Built-in WiFi
  • Ethernet 10M/100Mbps
  • Built-in WiFi
  • Ethernet 10M/100Mbps/1Gbps
Audio out
  • 3.5mm analog audio interface
  • I2S stereo digital audio interface
  • 3.5mm analog audio interface
  • I2S stereo digital audio interface
LCD LVDS LVDS
IR IR receiver IR receiver
SATA SATA Host socket SATA Host socket
Camera CSI CSI
Battery Li-Poly Battery Interface Li-Poly Battery Interface
USB 1 x USB host, 1xUSB OTG 1 x USB host, 1xUSB OTG
Power 5V, 2000mA 5V, 2000mA
Overall Size 121mm x 65mm 121mm x 65mm
Image download Image for pcDuino3  Image for pcDuino3B

 

Installing Ubuntu 14

Downloand the Ubuntu 14 Nand image here:   https://s3.amazonaws.com/pcduino/Images/v3/ubuntu14/pcduino3_livesuit_ubuntu14_GbpsMAC_20141231.tar.gz

 

Download Phoenix Suite for writing the Nand Image to the pcDuino from here:  https://s3.amazonaws.com/pcduino/Tools/PhoenixSuit1.0.6.zip

I didn’t have much luck getting Phoenix Suite to work in Windows 8.1 64 bit.  The USB driver does not install.  I however had success on Windows XP and Windows 7.

 

You will need two micro USB cables for writing the nand image.   You will also need a 5V 2A USB power supply.   I am using an iPad charger which is working just fine.

 

Plug in the USB power supply into the power USB port.  This is situated between the Ethernet port and the HDMI port.     Then plug in the second USB cable into the micro USB OTG port, which is situated next to the USB type A port on the opposite side of the board.   The other end of this cable will be plugged into the PC.

 

Run the Phoenix Suite software.     It will oddly say, “No Device Attached”, but ignore that.      Select “Firmware” which is top center of the dialog.   And browse to the image.   Note that this uses the “img” file, so be sure to extract the “gz” file that was downloaded.   I used 7zip to do this.   Click on the “Upgrade” button.  Again ignore any messages that pop up.

phoenix

On the pcDuino board press the “Upgrade” button.   While holding the button, press the “Reset” button.    These are both clearly marked on the board.

 

A popup will appear in Phoenix Suite: “Does mandatory format?”   Click “Yes”.

 

A few minutes later you should be greeted with a message:  “Upgrade Firmware Succeeded!”   Plug in a HDMI cable, mouse, keyboard and reset the pcDuino.   A moment later Ubuntu should boot and the GUI will appear on the HDMI monitor.  Also note the Tx and Rx leds on the board will both be lit up indicating success.

 

This is just the first step to exploring the pcDuino. I hope it was helpful.

FacebookTwitterGoogle+LinkedIn