he dream of cross-platform applications has been a holy grail of development since the dawn of the computer age. Most recently, the Java platform with its "Write once, run anywhere" is the promised end result of adopting the Sun philosophy. Java does deliver on those promises for the most part, but does so only at the cost of changing development platformsa cost far too high for many developers steeped in the Microsoft way.
Microsoft's Visual Studio makes it easy to develop Web-based applications using their ASP.NET environment. Until recently that meant you would have to host those applications on a system running Microsoft's Internet Information Server (IIS). Now, however, thanks to the release of Mono 1.0 that restriction has been lifted.
Mono is an open-source cross-platform implementation of Microsoft's .NET environment with support for the Common Language Runtime (CLR), a C# compiler, and ASP.NET using the XSP standalone server or an Apache add-in module (mod_mono). Mono currently runs on a large number of platforms including:
- Microsoft Windows (2000 and above)
- MacOS X (10.3Panther only)
- Sun Solaris
- Red Hat 9.0/x86
- Fedora Core 1/x86 and 2/x86
- Slackware 10
- SUSE Linux 9.0, 9.1, and Enterprise Server 8 for x86 Linux distributions
You can find instructions to get up and running with Mono on the downloads page of the Mono Web site
To test the Mono cross-platform claims, I decided to build a simple family calendar application. The overall goal behind this project was to evaluate exactly how portable a reasonably complex application could be. Therefore, I developed the application in C# and ASP.NET on a Windows XP machine using Microsoft's Visual Studio 2003, working from the following assumptions.
- The project would best be written in C#. The current preferred language for developing to the Mono .NET implementation is C#. While you could use VB.NET you're far more likely to run into a feature that hasn't been implemented on Mono yet.
- XML is a natural choice for storing the data for this application. Although Mono supports ADO.NET for accessing data in relational databases, it doesn't support reading Microsoft Access (.mdb) files on any platform other than Windows. Using a full-featured relational database such as SQL Server, Oracle, MySQL, or PostgreSQL is overkill for this project. As Mono does provide full support for reading and writing data to XML files, that's what I used for this demonstration. XML is a good format for storing and retrieving data in a cross-platform way but isn't truly relational and probably wouldn't work well for a large amount of data.
- The same code would run on both Windows (IIS) and Mono (XSP). I tested the completed code using the standalone Mono ASP.NET server, XSP, on a machine running SUSE Linux 9.1, as well as on my development machine running Windows XP and IIS. XSP works great as a developmental server to test code and to run low-volume applications, but it's definitely not suited for any high-hit-rate production Web server usage. For full-scale production usage you should target Apache using the mod_mono module (not tested).