Monoppix - Basic XSP (ASP.NET) and Monodevelop Walkthrough

Monoppix is a GNU/Linux distribution which includes Mono, XSP, and Monodevelop, and runs completely off a CD.  It allows you to get familiar with Mono development in Linux without installing anything on your computer.

This walkthrough was written for Monoppix 0.2.2.3. It will step you through:
  1. Downloading the Monoppix ISO
  2. Burning the ISO to a bootable CD
  3. Running Monoppix off the CD
  4. Starting the XSP server
  5. Testing an ASPX webservice
  6. Editing the ASPX file in Monodevelop
  7. Saving the ASPX file to your /home/knoppix/ directory
  8. Restarting the XSP server in your /home/knoppix/ directory
  9. Verifying your changes
  10. Quick info on taking screenshots in Monoppix (or any Knoppix)

1. Download the Monoppix ISO

The Monoppix ISO is available from http://monoppix.url123.com/download [404MB]. The download goes through Freecache which should ensure a high speed download.

2.  Burn the ISO to a bootable CD

The easiest ways to burn an ISO to a bootable CD in Windows are:
  1. Nero, using the CD-ROM (BOOT) option
  2. ISORecorder (free, XP SP2 or Windows 2003 need to use the ISORecorder v2 beta release)
  3. CDBurn (part of free Windows 2003 Resource Kit, works on Windows XP, command line only)

3. Running Monoppix off the CD

Make sure the CD is in the CD drive and restart your computer. If it boots in your normal operating system, reboot again and change the start device priority in your BIOS to set the CD drive to higher priority in the boot order than the Hard Drive. At the prompt, you'll need to enter a Knoppix cheat code to tell Knoppix what hardware to use. If you're using standard equipment, you're probably okay with just "knoppix" (without the quotes). If you're using a laptop or LCD monitor, "fb1024x768" will probably work.

4. Starting the XSP server

Open a console window (the taskbar icon that looks like a shell). Type the following command:

cd /usr/share/doc/xsp/test && mono /usr/bin/xsp.exe

This will start up the XSP server. You should see the following:


Next, open a browser. Monoppix includes Konqueror (the taskbar icon on the right) and Mozilla (in the Start menu). Browse to http://localhost:8080/


5. Testing an ASPX webservice

Click on the second link, TestService.asmx. Click the "Add" link on the left, then the "Test Form" link on the top. Enter two integers and submit the form:

6.  Editing the ASPX file in Monodevelop


You'll need to start Monodevelop from the command prompt in this release. Open a console window and type the following:
/KNOPPIX/usr/bin/monodevelop monodevelop


Select File / Open from the menu, then browse to /KNOPPIX/usr/share/doc/xsp/test. Open the TestService.asmx file.


Edit the code. My changes to the code are underlined below; feel free to make whatever changes you'd like as long as it compiles.
<%@ WebService Language="c#"
Codebehind="TestService.asmx.cs"
Class="WebServiceTests.TestService" %>

using System;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace WebServiceTests
{
   public class TestService : System.Web.Services.WebService
   {
      [WebMethod]
      public string Echo (string a)
      {
         return a;
      }

      [WebMethod]
      public string Add (int a, int b)
      {
         return String.Format("Here is your total:{0}",a+b);
      }
   }
}


7. Saving the ASPX file to your /home/knoppix/ directory

Since the TestService.asmx file is located on the  CD,  you can't save your changes there. You can save files to the /home/knoppix/ directory, though, since that's located on the RAM drive. Select "File / Save As...", navigate to /home/knoppix/, and save the file:


8. Restarting the XSP server in your /home/knoppix/ directory

If the console window from step 4 is still open and running XSP, select the console window and press Enter (or Return, if you have a really old keyboard) to close XSP.

In a console window, type the following command:

cd /ramdisk/home/knoppix/ && mono /usr/bin/xsp.exe




9. Verifying your changes

Refresh your browser window if it is still open, or open a browser and navigate to
http://localhost:8080/TestService.asmx

Verify that your changes have taken effect. In my example, I changed the output from a simple integer value to "Here is your total: xx". Well worth the hours of work:


10. Quick info on taking screenshots in Monoppix (or any Knoppix)

Monoppix doesn't include Ksnapshot. I took these screenshots with xwd. I used the following command:

xwd | xwdtopnm | ppmtojpeg > /home/knoppix/filename.jpg


2 Comments

Comments have been disabled for this content.