Windows Web Server 2008 on Virtual PC 2007

To allow me to test the ASP.NET MVC website project I am working on, and to also get a chance to play with some new technology, I decided to get a Virtual Server running that I could host the site on, up to this point I have been running IIS7 on my Vista laptop and debugging locally which has been fine. However, as the site uses API’s from the likes of Google and Flickr it means access to the API’s is locked to a specific Domain which then points to a specific IP address/Router/Server. Working on a laptop that could either be at home or at work, or even at a clients isn’t going to work. So Virtual PC to the rescue!! The server will be located on a PC at one central location, with access enabled so I can utilize remote debugging, it will also require MSSQL 2005 installed, with remote connections too.

I have tried this with VMWare Server 2 Beta, and it worked, kind of, but meant I needed to turn UAC off on the Vista machine it was running on, I don’t really know what UAC is, but as it is something to do with Accounts and Access Control I am guessing it is better to have it on than off. This doesn’t appear to be a problem with VPC 2007. Once I prove the concept on Virtual PC the host machine will move to a full Microsoft Virtual Server so I can host multiple machines for build servers, dedicated SQL boxes, version control server etc.

After getting hold of a copy of VPC and getting Windows Web Server 2008 from MSDN I installed VPC and was greeted with the “New Virtual Machine Wizard”:

I created a Virtual Machine using Vista for the default, and changing the HDD size to something that would be more manageable, I don’t need 64GB for running a handful of websites!! With the machine created I started it up and selected CD->Capture ISO Image… from the menu. Here I pointed it at the fresh DVD image of Windows Web Server 2008 I had downloaded. The PC then started booting from the image and presented me with the fancy new Windows Server 2008 install screen:

I selected the Full Installation option and let it copy files and install (I was hoping to be able to repeat this with a core install, but the core won’t let SQL Server or .NET run, so I am not exactly sure what use it is?). After only about 30 minutes the initial stage of the install was complete (this was even though the Virtual PC was sitting on a USB Drive) and I was asked to enter a new Administrator password, I then got to the Initial Configuration Tasks window:

I ran through the list of things to setup including the time zone, networking, computer name etc. I also set the Automatic Updates to download but ask me when to install to stop it rebooting in the middle of the night and breaking stuff when I wasn’t ready for it. I then left it to download and install any updates that were available at the time.

With all the available updates installed it was time to add the Web Server role to the server, so from the Add Roles option I selected the only available option, to add IIS, and accepted the Pop-Up that told me of the other items that had to be installed to make IIS work:

When I got to the Role Services screen I selected HTTP Redirection, the complete Application Development option, Windows Authentication as well as the IIS6 Management Compatibility and associated options for it as I know I will need it later. I also added FTP as it will make it easier for transferring files to the server if I am not in the same location as it and can’t use a networked drive. Then I let it install:

Once it completed I was able to browse to http://localhost and see the default IIS screen to make sure it was running correctly:

The final thing to do was enable RDP, unfortunately I will need to access the Server from XP machines so I couldn’t turn on the Network Level Authentication.

I then installed Virtual Machine Additions, the VPC version of VMWare Tools, from the Action->Install or Update Virtual Machine Additions menu item.

Now I was ready to install the additional software I would need on the server to actually make it usable. Although the site I am working on at the moment is in ASP.NET I also need to work on the odd site that is in PHP with MySQL databases, so I took the time to get versions of these installed to make sure the server was as multi-purpose as possible. The easiest way I found to actually get the files on to the server for installation was to Share a folder by clicking on the folder icon in the status bar of VPC and selecting which folder I wanted on the host machine. With this done I could download all the installers I needed without battling with IE’s locked down status and having to add a heap of sites to the allowed list. I will be installing the following apps:

· Notepad++

· WinRar 3.7.1

· PHP 5.2.6

· PhpMyAdmin 2.11.6

· MySQL 5.0.51b

I am also going to take the opportunity to install a patch for Server 2008 that will allow MSSQL 2005 to be installed; more details can be found here: and the download is here:

Notepad++, WinRar and Windows Update KB950636 were installed just by running the installers, next on the list was PHP.

There is a PHP installer, but having struggled many times with it and always ended up having to modify stuff I just use the zip file and install it manually. Firstly I extracted the PHP zip file into a folder located at Drive Letter:inetpubbinPHP I did this for 2 reasons, one it means that the organisation and locations of the folders and files is logical, and also so that the correct permissions are inherited by the folders and files from the inetpub parent folder so permissions errors “shouldn’t” be a problem.

With the files extracted it is time to fire up the new IIS 7 management console:

I added a new Module Mapping from within the Handler Mapping section for PHP to use the FastCGI module, and accepted the Add Module Mapping dialog that appears:

I then needed to manually add PHP to the ISAPI and CGI Restrictions tab to allow it to run, on some of the install instructions I have seen for this it has been added automatically, so lucky I checked:

With this all done it was time to create the simple PHP file that will test the install is working:


I saved the file in the root of the web server and then browsed to it:

To get some apps to work in PHP I need to enable some extensions, so I renamed the php.ini-recommended file to just php.ini, then using Notepad++ changed the extension_dir directive to “./ext” and then removed the comments from the mbstring and mysql extensions to get everything working.

Now time for MySQL, I ran the installer for a Typical Install, and then in the configuration I chose the Standard Config as it is the first and only MySQL instance on this box:

MySQL was installed as a service, and I entered a new root password then let it do its stuff:

Install successful, now time for PhpMyAdmin, I extracted the zip that I had downloaded into a folder beneath the root of the web server, before browsing to the app I renamed the file to in the root of the phpMyAdmin folder. I also changed the Authentication type from ‘cookie’ to ‘http’, so now when I login I am presented with the HTTP Basic Authentication login box, so for now I can login using the root user and password:

Now onto MSSQL; Firstly I mounted the MSDN image I downloaded in VPC and ran the Autorun:

I accepted the warning that SP2 needs to be applied to make SQL Server function correctly on 2008, and then continued with the install. (You may find at this point, if you didn’t follow all the instructions for installing IIS that SQL Server gives a warning about IIS problems, if you don’t need reporting services then these can be safely ignored, if you do check the list of modules I mentioned earlier to get everything installed.) I selected SQL Server Database Services and Reporting Services from the Install option list. For the service account I added a user from the local machine the server is installed on, and left everything else as default:

Eventually the install completed successfully. I then installed SP1 and SP2 for SQL Server. When installing SP2 I had to quit a couple of processes using task manager which were indicated by the installer to be locking files that were to be updated during the install. Using the User Provisioning tool that popped up after SP2 finished installing I added Admin permissions to the Administrator user on the box.

However, this didn’t sort out the problem of logging in remotely. For that I needed to follow the instructions from Microsoft, I then needed to change a few other settings to get the right user to login.

The main issue is that as I am not running a domain so using Windows Authentication isn’t going to work when all of the usernames are prefixed with the computer name. Also, the main purpose of this server is to act as a web server, and the websites that will be tested on it will not be using Windows Authentication for accessing the SQL Server. So to sort this all out and allow me to remote login from my dev machine and user SQL Server Management Studio from there I added a user to the server by right clicking on the Security->Logins folder within Management Studio (this is done directly on the server, as obviously we can’t remotely login yet!!):

This presented me with the new user login form which I filled out for an SA user:

Now for my own personal reasons I turned off the password policy stuff and gave my user database admin rights. I can do this because the server is not a production box and is also hidden behind multiple firewalls and other security obscuring it from malicious use. However, it is still a security risk so not something I would advise others unless you know what you are doing. I also take no responsibility for anything happening to anybodies system if they follow this guide, I am not a security expert, I am willing to take the risk on my own test box as I understand the consequences.

With the new user added I just needed to make one more change to the database configuration to get the remote logins to work, which is on the Server Properties page (right-click the server instance in Management Studio select Properties), and then under security I selected SQL Server and Windows Authentication mode:

With this completed I was able to login remotely from my dev machine!!

So now I have a test server that I can RDP to, is running IIS7, .NET 3.5, SQL Server 2005 SP2, PHP 5 and MySQL 5 along with PhpMyAdmin, everything I need to get some work done.

This completes the guide for now, I will add further posts for remote debugging using Visual Studio 2008 and also remote PHP debugging using Eclipse and Xdebug as I get them working, but I think this post is long enough for now!