Sunday, October 17, 2010

Using Mono

I have been involved in developing .NET web applications  since quite some time now. Usually the applications are targeted for the Windows OS, using IIS as a web server. This particularly helps organization already having users setup and running on windows that could authenticate and authorize themselves against their windows accounts to utilize the web applications. However I quite frequently dabble with code on my home laptop, which runs Windows Vista Home Basic (among others). Not pretty eh !? This does not and can not have an IIS installation. So all I had to rely was on Visual Studio Express edition (since I don't like spending money on stuff), and debug applications using the mini ASP.NET web server shipped with the Visual Studio Express. There were two problems with this :

1) I could only debug my applications. Never actually host them on my laptop.
2) I have a mediocre home laptop. 1.66 GHz dual core processor and 2 GB RAM. Visual Studio Express wasn't helping me achieve efficiency (while working, it would easily hog all the resources).

So I dug up some articles on the web, and found out that I could install Apache HTTPD web server on my laptop, and install the mod_aspdotnet module, to host ASP.NET web applications. This was pretty cool. The HTTPD web server is pretty fast, and doesn't hog down the laptop. Perfect. I could develop applications in Visual Studio Express, and host them on the Apache web server (HTTPD) to see how things work out in real time. So far so good.

But again there were some limitations. Apache community doesn't actively develop/contribute to mod_aspdotnet module, and since then it has been maintained by its own community. It is compliant with only up-to .NET 2.0. But the biggest problem of them all was that I rarely used Windows, and most of the time I am using Ubuntu. Working on windows meant spending away time from my favorite OS and feeling guilty about it.

But if there is a problem, there is always a solution, because chances are you are not the first person to have hit that roadblock. I read about Mono and have been using it ever since. It installed seamlessly on Ubuntu, and does not even hog my laptop resources. It comes with a mini xsp2 web server to let you debug the web applications, and you can also install apache HTTPD together with mod_mono module to host the web applications for real time experience. The bonus is Mono is binary compatible with up-to .NET 4.0 (barring some features). And I am in love with Mono ever since. Apart from the web development you could also do all the console, windows forms, and GTK# development.

Since then I have created solutions using Visual Studio, opened them in Mono from Ubuntu, compiled them in both places, and hosted them on IIS and HTTPD. Totally binary compatible. No issues noted.This is what I call true cross platform development. And as a matter of fact Mono can be installed on Windows as well. Open source for .NET has arrived. Next time some one ridicules .NET to not be truly cross platform, here is the answer. Mono. The only drawback I have found with Mono's IDE is that it doesn't provide for rich design time tools for web site design. However It makes great stuff for trying out code snippets, working on console applications, and creating class libraries and web services.

Here are the links for the softwares I have mentioned in this article. So that you could read more, and decide what combination is best for you :-

Visual Studio Express
Apache HTTPD web server
Project Mono (for Mono runtime, mod_mono module for Apache HTTPD, and the IDE MonoDevelop)

And this is the blog which helped me actually configure mod_aspdotnet on Apache HTTPD

It has only been few weeks since I first started experimenting with Mono, so not all information above might be accurate. There could be omissions or oversights on my part. I would be more than glad if anyone points those out, and helps me move ahead. 

No comments:

Post a Comment