Raspberry Pi 2 Mono C# Client Calling a Web Service

After turning the Raspberry Pi 2 mini-computer into a RabbitMQ message queue server and FM radio transmitter, calling web services from the device was next. I compiled a rudimentary C# console application on a Windows machine. The C# console application calls the Frankenstein web service (Experiments > Keep-Alive) to determine whether or not a website is alive and contains a specific text string.

1. Created new C# console application.

2. Added Frankenstein web reference to application

3. C# code:

bool r = false;
bool s = false;
frankenstein.Frankenstein f =
new frankenstein.Frankenstein();
f.IsAlive( "http://www.oproot.com", "Oproot", out r, out s);
if (r)

The method connects to a web service that checks to see if a url is accessible and if the returning page contains a particular text string. The website in the example is online, accessible, and contains the specified text, so the program is expected to return the "alive".

Compiled, the application consists of two files: frank20.EXE file and frank20.EXE.config file. I send the files over to the Raspberry Pi and run a couple of commands to install mono.

As sudo...
apt-get update
apt-get install mono-runtime
apt-get install mono-complete

With Mono installed, the C# application frank20.EXE file is run on the Raspbian Linux Raspberry Pi with the following command:

sudo mono frank20.exe

The C# application runs successfully, connects to the web service for processing and returns the value ("alive") back to the Raspberry Pi console. With Mono, C# source code is deployed to and run on Linux/Raspbian/Debian.