.net 2.0 + mono + ubuntu

assumes apache2 installed via apt-get

apt-get install mono-apache-server2
apt-get install libapache2-mod-mono
a2enmod mod_mono
/etc/init.d/apache2 restart

edit the virtualhost file or httpd.conf file and add this to the end. In the case of virtualhost, for some reason this must reside outside of the tags.

        MonoPath default "/usr/lib/mono/2.0"
        MonoServerPath default /usr/bin/mod-mono-server2
        AddMonoApplications default "/:/var/www"
                MonoSetServerAlias default
                SetHandler mono

create a file called NumberService.asmx and place the following code:

<%@ WebService Language="C#" Class="MathService.MathService" %>

using System;
using System.Web.Services;

namespace MathService
	[WebService (Namespace = "http://mono.local/NumberService")]
	public class MathService : WebService
		public int AddNumbers (int number1, int number2)
			return number1 + number2;

		public int SubtractNumbers (int number1, int number2)
			return number1 - number2;

Be the first to comment

Leave a Reply

Your email address will not be published.