Debianhelp.co.uk


Running ASP.NET Applications in Debian using XSP and Mono

What is Mono ?

Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell, the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications.

What is XSP ?

XSP is a “light-weight web server” capable of hosting and serving ASP.NET applications. It is written using C#, making extensive use of the classes in the System.Web namespace.XSP web server runs on both the Mono runtime and also on the .NET runtime.

Download Mono and XSP

http://go-mono.com/sources-stable/

Mono Screenshots

http://www.mono-project.com/Screenshots

Mono Documentation

http://www.go-mono.com/docs/

Mono FAQ

http://www.mono-project.com/FAQ:_General

Now we are going to take a look how to install XPS and mono for ASP.NET applications and testing this setup

Install mono in Debian

If you want to install mono in your debian system you need to run the following command

#apt-get install mono mono-gmcs mono-gac mono-utils monodevelop monodoc-browser monodevelop-nunit monodevelop-versioncontrol

Install XSP Web server in Debian

If you want to install ASP.NET2.0 version use the following command

#apt-get install mono-xsp2 mono-xsp2-base asp.net2-examples

If you want to install ASP.NET1.0 version use the following command

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

This will install all the required development environment and sample applications

Testing your ASP.NET Applications

We have already installed sample applications

If you want to run ASP.NET 2.0 application you need to go to /usr/share/asp.net2-demos/ run the following command

#xsp2

This will start the XSP with ASP.Net 2.0 application

xsp2
Listening on port: 8080 (non-secure)
Listening on address: 0.0.0.0
Root directory: /usr/share/asp.net2-demos
Hit Return to stop the server.
Application_Start

Now you need to point your web browser to http://localhost:8080/

You should seen the following screen

If you want to run ASP.NET 1.0 application you need to go to /usr/share/asp.net-demos/ run the following command

#xsp

This will start the XSP with ASP.Net 1.0 application

xsp
Listening on port: 8080 (non-secure)
Listening on address: 0.0.0.0
Root directory: /usr/share/asp.net-demos
Hit Return to stop the server.
Application_Start

Now you need to point your web browser to http://localhost:8080/

You should seen the following screen

Possible errors

If you get the following error when you point http://localhost:8080/

Error Message: HTTP 404. File not found /usr/share/asp.net2-demos/index2.aspx

Solution

You need to copy the index.aspx to index2.aspx

#cp /usr/share/asp.net2-demos/index.aspx /usr/share/asp.net2-demos/index2.aspx