Debugging Mono Web Services   June 27th, 2014

I had this problem that the asmx files did display fine in the browser, but when I called a function, it would always return a red Zero.

To get to the bottom of this problem, I created a web.config file with this content:

        <customErrors mode="Off"/>
    <compilation debug="true" />

Best to use a clean directory without a bin subdirectory, for testing.
Use the MathService sample asmx file from

<%@ WebService Language="C#" Class="MathService.MathService" %>
using System;
using System.Web.Services;
namespace MathService
	[WebService (Namespace = "")]
	public class MathService : WebService
		public int AddNumbers (int number1, int number2)
			return number1 + number2;
		public int SubtractNumbers (int number1, int number2)
			return number1 - number2;

Starting the xsp server for testing purposes:

. /opt/mono/
cd /var/www/openpetra
MONO_OPTIONS=--debug xsp4 --port 80 --verbose

When you now call the asmx file in your browser, you see the output on the console.

In my case there was an error about sqlite3.dll in the bin directory, which is a windows dll, and this caused trouble for the server.

But it still did only show a red zero. Finally I looked at the html source of the asmx file in the webbrowser, and I realised that the ports got mixed up, since I was using port forwarding into a virtual machine. So the port defined in the webbrowser was different than the port that xsp was running on.

The url in the browser is: http://myhost:8090, but this is the url in the source code:

getXML ("GET", "http://myhost/test.asmx/SubtractNumbers", "number1=asf&number2=asdf");

To solve this: make sure that in your /etc/lighttpd/vhosts.d/openpetra9000.conf, you have a set with a value that the server is reachable from the client.
It seems the document path is also part of You can put the port into another variable called server.port, but then the port will be attached to the, after the document path.

In the end, I am now only using the default port.

Tags: ,
This entry was posted on Friday, June 27th, 2014 at 12:34 pm and is filed under Software Development. You can follow any responses to this entry through the RSS 2.0 feed.Both comments and pings are currently closed.

No Responses