I wanted to build this website to write up my experience of software testing, particularly Test Automation, Management and Reporting as well as Web Application Performance. Originally, it was going to be pure HTML and CSS, with a smattering of jQuery due to my obsessive desire to keep getting 'A' grades from YSlow. I was also going to maintain a spend-free approach and build the site on an old PC running Apache on Ubuntu.

Eventually, I realised I needed to provide some interactive examples based on work I'd done back at the office, which is almost exclusively a Windows shop. Not wanting (or being able to) pay the Windows tax, I've given myself 6 months grace by installing trial versions of Windows Server 2003 and SQL Server 2008. These are running inside a single virtual machine (I only have 1 gig of RAM to share between them all) running on VirtualBox.

Installing Ubuntu and Apache

Download a CD-size .iso image from ubuntu.com, burn it, run it and in less than an hour you have an OS with tons of useable development applications and you're only a few clicks away from installing a working Apache webserver and VirtualBox via Synaptic.

I'm just saying, is all.

Installing Windows Server 2003

Oh boy!

Download the CD-size .iso image from TechNet and spend the next 3 days cursing, pulling your hair out and grinding your teeth. As if just getting hold of a trial isn't bad enough (see Questions). Anyway, I digress...

After installing Windows Server 2003

At the time of writing, Microsoft were promoting Web Platform Installer as an easy way to get a webserver and database built and working. My advice is to avoid it like the plague - unless you enjoy spending days Googling for fixes to the SQL Server Installer Infinite Loop. I would recommend you find stand-alone installers for IIS, ASP.NET, .NET Framework, SQL Server Express and Visual Web Developer.

Install each of these and choose to grimace or not as you are forced to reboot after each one. And then the Updates...

Starting the Application (Web) Server

After several hours you are suddenly at the point where you can nearly start doing something so you add an Application Server role and go through the "security" wizard. Then you type http://[WindowsServer]/ into Firefox in Ubuntu and you get to see some dreadful welcome page about the IIS not being configured yet. Fire up Visual Web Developer and publish a simple page to localhost on [WindowsServer] and browse to it again to check the plumbing.

Installing SQL Server Express 2008

Hopefully, you've ignored the Web Platform Installer and installed SQL Server Express 2008 as a stand-alone. And then the Updates. And rebooted 15 times. You could install SQL Server Management Studio but the Database Explorer in VWD allows you to do most things you'll need. At this point you should have a SQL Server running but will not be able to connect to it. You will need to fire up SQL Server Configuration Manager and in SQL Server Services set the SQL Server Log On to the built-in account "Network Service".

The End Result

Apache and IIS - can't we just get along?

The reason I put myself through the pain of installing a Windows Server VM was so that I could provide a demonstration of JAWS - issuing SQL commands from jQuery via an ASP.NET WebService which involved making cross-domain calls from Apache on the Ubuntu host to IIS on the Windows VM - resulting in much hilarity, several 403s, 301s, 302s and assorted spurious permissions errors. I only have a single external IP address, so IIS on the Windows VM couldn't be assigned a proper URL and had to stay on the internal network.

What didn't work 1 - port forwarding on the router

My first attempt was to go into my router's management console and assign port 8080 to the VM. It worked in so far as browsing to http://testing.misconfused.org:8080/ took me to the default web site on the Windows VM but relative URLs were a mess, Firefox refused to honour any kind of cross-domain Ajax trickery to contact the web service and it just clanged to have the URL change abruptly while browsing the site.

What didn't work 2 - JSONP

Some Googling led me to believe that issuing JSONP requests to the web service would be allowed. Naturally, this meant typing an extra character in the jQuery call - oh and building a class library containing an HTTP response filter to add the JSONP functionality currently lacking in ASP.NET. Even after making all that effort, however, Firefox was still having none of it.

What didn't work 3 - Shared Folders

So then I think I'll just share a folder between the VM and the Ubuntu host and publish the website there from VWD.

This was A Very Stupid Idea.

All I got was Apache trying to serve the .asmx web service page instead of it going through IIS. I was so embarrased (but it was getting late by this point).

What didn't work 4 - mod_rewrite

After sleeping on it, I decided what I needed to do was go into Apache's config and set a rewrite rule from http://testing.misconfused.org/ASP/ to http://testing.misconfused.org:8080/ to fool Firefox into honouring cross-domain Ajax. Firefox was not fooled and still returned 301s or 302s when I tried to call the WebService.

What DID work - ProxyPass

Finally! I installed the mod-proxy modules in Apache and added this to the .conf file for the testing.misconfused.org virtual server


ProxyRequests off
ProxyPass /ASP http://[Windows VM internal IP]
ProxyPassReverse /ASP http://[Windows VM internal IP]

And in proxy.conf, allow all addresses to trigger this proxy pass (but not act as an open proxy):


<Proxy *>
AddDefaultCharset off
Order deny,allow
Allow from all
</Proxy>

Bliss!

What ALSO worked - avoiding the issue

Replacing IIS/ASP.NET with Apache/mono means I can remove the proxy rules, puts less strain on the system and circumvents the cross-domain issues.

Questions

Why Server 2003 and not 2008?

Because the smallest trial I could find for 2008 Server was a 20 gig download - I'm sure that can't be right but the first download I found of 2003 Server was a more reasonable 700 megs. The 2008 trials site is far too convoluted for me to bother looking any more. If Microsoft spend a little less time trying to tell you how much better Windows is than Linux and a little more time trying to make it easier for you to find out for yourself, they might make a few more friends...

Why VirtualBox and not VMware?

I've used VPC and VMware extensively at work and VMware at home until quite recently - for me VirtualBox offers better performance (but see below).

But in the end, I went back to pure LAMP

Even after conquering the proxy issue and removing IIS from the equation, the high CPU bug in VirtualBox was too severe too ignore, so I junked the 2003 Server image hosting SQL Server entirely and converted the database and WebService calls to MySQL and PHP. I kept the PHP calls as close to the ASP.NET versions as I dare, so that anything I did could be translated to my work environment without too much fuss.