Debian Admin - Your way to Debian World

November 10, 2006

Running ASP.NET Applications in Debian and Ubuntu using XSP and Mono

by @ 10:55 am. Filed under General, Webserver, Other Linux

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Mono is an open-source project providing the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Monodevelop is probably the best IDE for developing .NET applications on Linux. In order to install and use it for development, you will also need the Mono .NET runtime environment installed.

Mono has a fully functional implementation of ASP.NET. This includes full support for ASP.NET Web Forms and Web Services. This essentially means that more or less any ASP.NET application that you have developed using with the .NET Framework will work with Mono. Obviously there might be changes needed, such as data access changes, removal of any
reliance on .NET Framework BCL types that are not implemented in Mono yet, and also the removal of any code that makes
use of platform invoke and so on. At this stage the ASP.NET support in Mono can be considered as excellent and a lot of
publicly available web applications already make use of Mono’s ASP.NET support.

when using ASP.NET with Mono you have two options as regards which web server to host your ASP.NET applications that is XSP and Apache we are using here XSP.

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.

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

First thing is you need to install mono

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

You can can see in this screen which will install all the required packages

Install mono in Ubuntu

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

sudo 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

Install XSP Web server in Ubuntu

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

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

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

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

This will install all the required development environment and sample applications for ASP.NET

Test 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

If you want to know more options available for XPS check here

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

For Debian Users

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

For Ubuntu Users

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

Tags: , , , , , , , , , , ,

You may also be interested in...

9 Responses to “Running ASP.NET Applications in Debian and Ubuntu using XSP and Mono”

  1. David Costelloe Says:

    Hi,
    Great sample I am using Ubuntu and this helped a lot. My issue is that when I try to run the http://localhost:8080/ I Get the following:
    Server error in ‘/’ application
    File ‘/’ not found.
    Description: Error processing request.

    Error Message: HTTP 404. File ‘/’ not found.

    I also used the sudo cp /usr/share/asp.net2-demos/index.aspx /usr/share/asp.net2-demos/index2.aspx
    with same results.
    Any help would be appreciated

    Thanks
    David…….

  2. Admin Says:

    if you install asp.net version 1 documents you should be able to see the test page

  3. Dragos Cirjan Says:

    Any ideas how to make apache2 and mono work together? mod_mono ? Do ya know how to configure them?

  4. Isaac Says:

    Another option is the Neokernel, there is a release for Mono of the
    Neokernel Web Server at www.neokernel.com, it’s easier to run ASP.NET with
    the Neokernel than with XSP or apache/mod_mono.

  5. pepesmith Says:

    To David:
    – i think i’m late on posting this :)
    You must be on the directory /usr/share/asp.net2-demos/ before you run xsp. Otherwise that error will be displayed.
    Please take note this when you run xsp, you should see the Root directory: /usr/share/asp.net2-demos/
    HTH.

  6. Peter Says:

    Hi all. First of all, thank you for this excellent tutorial. I have an asp.net 2.0 app that I used to run on IIS but I am trying t get it to work on Ubuntu with Apache. However, this app uses an MS access database and I cant put xsp to work with this. Any ideas?

  7. techieguy Says:

    To pepesmith: Your solution worked perfectly fine for me. Thanks :)

    I am getting index2.aspx not found error now.

  8. techieguy Says:

    It’s working now!!! Here is the solution for Ubuntu users:

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

    I got this solution from a blogger in another site.

  9. Gerd Says:

    I installed Ubuntu 7.10 with PHP and mySQL and also installed mono for ubuntu (both, xsp1 and xsp2) with examples/demos.
    When running xps or xps2 I seem to get the predicted responses.
    However when going to http://localhost:8080/ the following is displayed in the browser in either case:

    Server Error in ‘/’ Application
    File ‘/’ not found.

    Description: Error processing request.

    Error Message: HTTP 404. System.Web.HttpException: File ‘/’ not found.

    Stack Trace:

    System.Web.HttpException: File ‘/’ not found.
    at System.Web.StaticFileHandler.ProcessRequest (System.Web.HttpContext context) [0×00000]
    at System.Web.HttpApplication+c__CompilerGenerated2.MoveNext () [0×00000]

    12/06/2008 7:44:25 AM

    —————————————

    what went wrong? Mind you, I am also quite new to Linux and ubuntu in particular and can do with all help I can get.

    Cheers, Gerd

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.