Quick and Dirty ASP.Net on Linux – Ubuntu, Mono and MonoDevelop

Having become inspired by the recent TTLUG activity in finally setting up the new TTLUG website, as the group’s Trustee I found myself ashamed that I did not even have a Linux machine readily available to hack anymore. My work took me so far into the C#, ASP.Net, and now ASP.Net MVC worlds, that I had little time for Linux or Linux-based Open Source software. Thankfully, fate stepped in.

I saw my coworker about to throw away several old IBM T23 Thinkpads. Now if you know and love classic hardware like I do, the words “throw away” and Thinkpad just don’t come in the same sentence, those babies are beasts. I managed to get two of them, and 2 spare batteries.

On bootup at home one of these machine’s hard disks failed while Ubuntu was installing to its hard disk, however the other took the Ubuntu 8.04 CD installation with quite a surprising speed for a lowly Pentium 3 with 256MB RAM. After doing the expected setup without hassles and updating the distribution via the Internet (using a  network cable since there is no built-in wireless in the T23) I rebooted and now had a full Ubuntu desktop system ready to go.

The first thing I was curious to see if I could do was build and run a traditional ASP.Net web page and get it running on Linux. I had tried several years ago and the process was painful and I ended up giving up before I succeeded in resolving all the issues. I was pleasantly surprised then by the *almost* painless experience this time around.

Launching Synaptic Package Manager, a quick search in it for Mono revealed the package I needed to install, and I saw the results also included the package for MonoDevelop, a RAD tool I used in my first experience all those years ago. I instantly clicked on it, not only because I had liked the tool, but because of a rule of thumb I learnt when dealing with smart installation tools like apt and its GUI-frontend Synaptic Package Manager i.e. when not knowing exactly what to install in Linux to get developing with a language, installing an IDE for that language should ensure all the dependency installation packages were also checked.

After clicking apply, and the downloads had installed I ran MonoDevelop, and used the menus to create a new ASP.Net Web Application in C#. A little browsing through the buttons at the top menu revealed the Run button (the one with the cogs), and this is where my first hurdle was hit. The build failed, reporting that “Build failed: Executable not found: /usr/bin/gmcs”. Undaunted, I did a quick Google search for the error, which resulted in a link to this Ubuntu forum thread, which indicated if I installed the package manually it would take care of the issue. Another answer in this thread recommended I also install automake.

After starting a bash Terminal and running the commands

sudo apt-get install mono-gmcs
sudo apt-get install automake

I went back into MonoDevelop and tried to run my web application again. This time the application compiled, however when it tried to run I was hit with an error window stating ‘xsp2 server not found’. Learning immediately from the previous error that it was probably a missing dependency I went back to my Terminal and typed the command

sudo apt-get install xsp2

which installed the xsp2 server and its dependencies. Again in MonoDevelop I clicked Run, and was quite happy to now see my test default page open up in Firefox, with xsp2 hosting it at localhost:8080.

Now that I’m up and running, I’ll probably be browsing the Mono project site a little more often for tips and hacks I can use with my new Ubuntu system using my experience as an ASP.Net developer. Hopefully by the next Ubuntu release someone who knows how to will have fixed the bug that left out these few important files from the present installation and iron out the current kinks in the system.

10 thoughts on “Quick and Dirty ASP.Net on Linux – Ubuntu, Mono and MonoDevelop

  1. thanks for the post…ironic because I’m a Windows Dev lifer who is looking to jump ship – my XP laptop is currently FUBAR through misadventures with SQL/.NET installations, and I’m installing Ubuntu and Mono to be able to concentrate on Development not patches/viruses/systems annoyances…Cheers, Billy

  2. I jumped ship from windows a few months ago after falling in love with ruby on rails (sorry I don’t see performance increases with win7) and found it easier to code on ubuntu. I still have a few old asp.net websites and found monodevelop missing some important stuff, like the ability to edit master pages, and file import stuff (and the awesome css editor that visual studio has). good luck with ubuntu.

  3. Someone necessarily assist to make critically articles I would state.
    That is the very first time I frequented your website page and up to now?

    I surprised with the analysis you made to make this particular submit extraordinary.

    Wonderful job!

  4. I do not leave a response, however I looked through some
    comments on Quick and Dirty ASP.Net on Linux –
    Ubuntu, Mono and MonoDevelop | Redditech ‘Ground Zero’ Blog.
    I do have some questions for you if you don’t mind. Could it be simply me or does it look as if like a few of these comments come across like they are written by brain dead people? 😛 And, if you are posting at additional online sites, I’d like to keep up with anything fresh you have to post.
    Would you make a list of every one of all your
    social sites like your twitter feed, Facebook page or linkedin profile?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s