We have upgraded all the code of OpenPetra to .net 4.0.
We also upgraded to Ext.Net 1.2.

There were two bugs in Mono 2.10, which were show-stoppers:
http://bugzilla.xamarin.com/show_bug.cgi?id=2505 was a problem with the mono compiler, in Mono 2.10.x
This was fixed in mono master.

So I tried to build mono from master, but then I had problems with fastcgi, while xsp4 was serving the content correctly:
This was also fixed in mono master.

Below is a link to a tar.gz file, that contains the build of Mono, with mod_mono and xsp, at the beginning of February 2012.

I wanted to use lighttpd and fastcgi with Mono and Ext.Net, but that did not work.
The error that I got was similar as to described here, but without a solution that works for me:
It works fine with xsp4.

I then tried with mod_mono and apache2:
I came across this issue http://forums.ext.net/showthread.php?12348-404-Not-Found-for-a-few-resources-requests, that the resources cannot be loaded. The solution from that thread also helped me:
Add CleanResourceUrl = “false” to your .aspx file:

<ext:ResourceManager  runat="server" CleanResourceUrl="false" />
So here are my configuration steps for Ext.Net with Mono and Apache2:

This works with Ubuntu Oneiric 64 bit (11.04). But it might work on other Ubuntu/Debian version as well. I have also used it on CentOS.

apt-get install apache2
cd /opt
wget http://download.pokorra.de/mono/ubuntu/mono.tar.gz
for 32 bit: wget http://download.pokorra.de/mono/ubuntu32/mono.tar.gz
tar xzf mono.tar.gz
cd /usr/lib/apache2/modules/
wget http://download.pokorra.de/mono/ubuntu/mod_mono.so
for 32 bit: wget http://download.pokorra.de/mono/ubuntu32/mod_mono.so
cd /etc/apache2/mods-enabled
wget http://download.pokorra.de/mono/ubuntu/mod_mono.conf
# note that mod_mono.conf contains this line:
# MonoServerPath /opt/mono-2.10-git/bin/mod-mono-server4
vi /etc/init.d/apache2
# search for LANG, and replace with this line:

ENV="env -i LANG=en_GB PATH=/opt/mono-2.10-git/bin:/usr/local/bin:/usr/bin:/bin"

Mono will create a directory /var/www/.mono which should not be public.
In your apache site configuration file, add just before 

           Deny from all

cd /var/www
wget http://download.pokorra.de/mono/ubuntu/extnet-sample-mono.tar.gz
tar xzf extnet-sample-mono.tar.gz
chown -R www-data:www-data /var/www
/etc/init.d/apache2 restart

See the result here:

This is the demo for the Desktop from Ext.Net 1.2, with a slight modification in Default.aspx and Desktop.aspx for the ResourceManager as described above.

Ext.Net and Mono   March 15th, 2011

I like ext.js/Sencha for having a rich client in the browser.

On the other hand, we are using Mono for running our .Net server.

ext.net is a good library that helps you to easily write web applications, based on your .net libraries.

For OpenPetra, I have created an online application system, and the backend for the registration office is written with ext.net.
Here are some problems I came across, and how I solved them:
First, I had to recompile the ext.net dlls and also the Newtonsoft.Json.Net20.dll.
The Newtonsoft.Json.Net20.dll has been compiled with the latest compiler built from Mono 2.8 trunk. This was necessary so that no Microsoft dlls were linked in.
The ext.net dll was built against the Mono compiled Newtonsoft.Json.Net20.dll on Windows with SharpDevelop. The mono compiler crashed on Linux when trying to build the ext.net solution.
The resulting files are available from the online source repository of OpenPetra, eg. http://bazaar.launchpad.net/~openpetracore/openpetraorg/trunkhosted/files/head:/csharp/ThirdParty/ext.net/
I was not able to get Ext.Net to run with the latest Mono 2.8, but it is working fine with 2.6.7.
I had to build it from the sources.
Some links related to the problems I had with Mono 2.8 and Ext.Net:
compile ext.net: There is no implicit reference conversion from `Ext.Net.ComboBox’ to `Ext.Net.ComboBoxBase
Running ext.net on Mono 2.8: get the error: Cannot add a Ext.Net.Parameter to System.String
For the moment, the solution for me was to use Mono 2.6.7.
The examples of ext.net only show the c# code inside the aspx file, but with growing size of the code it would be good to be able to split the code behind code from the UI code.
This is possible, but you need to define all controls in the .cs file, at least those you want to use in your code behind code.
In the aspx file, make sure you have at the top:
<%@ Page Language="C#"
src=”Desktop.aspx.cs” %>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

see the whole file here: OnlineRegistrationBackend/Desktop.aspx

Now I ran into errors like this when Mono was compiling the code on the fly:

Compiler Error Message: CS1644: Feature `anonymous types’ cannot be used because it is not part of the C# 2.0 language specification

I found on the Internet this page: http://www.4guysfromrolla.com/articles/121207-1.aspx

linked from http://web.archiveorange.com/archive/v/c2PM7RMRJf7Ti7PP7uVb, where they discuss how to use “extension methods” and “collection initializers” with Mono.
I have added all those settings to my web.config, see the result here:
You can see a running demo here: http://demo.openpetra.org:8009/

I wanted to provide an online version for the project Delphi2C#, so that people can just paste their Pascal code on the website, and see how good the converter is for them when it displays the C# version of their code.

On Debian, you need to install:

apt-get install mono-xsp asp.net-examples

This will give you a file


It already contains the configuration for the samples, that live in


To start the xsp server, you just run

/etc/init.d/mono-xsp start

And you will be able to access the samples at


For example to add your own aspx file, copy it to


The source code of that file you can see here:
Browse CVS of Delphi2C#

If you have a dll as well, copy that to


In your aspx file, you need to write at the top to use that dll:

To debug your application (e.g. I had compiled the DLL for .Net 2.0, but the xsp only supported 1.1 and crashed without any message to the browser):

cd /usr/share/asp.net-demos
MONO_OPTIONS=--debug && xsp --verbose

Then in the webbrowser go to


You will see all the Console.WriteLine output, and also any exceptions and Mono crash messages.

Tags: , , , ,
Posted in Software Development | Comments Closed