1. First install Microsoft Visual C++ 2008 SP1 Redistributable Package (x86).Even though the machine is running Server 2008 (x64) the MapServer binaries that I am using is from MS4W which is for x86. (I have not tried to get the 64 bit version working yet).
2. From Server Manager select Roles and add the web server role with the following Role services:
- Application Development
- .NET Extensibility
- CGI
- ISAPI Extensions
4. Following the instructions here, I created a separate folder (c:\MapServer) and copied the follow folders into this directory: c:\ms4w\Apache\cgi-bin, C:\ms4w\gdaldata, C:\ms4w\gdalplugins, C:\ms4w\proj and C:\ms4w\tools.
5. Copy the C:\ms4w\setenv.bat file into c:\MapServer and modify it as follows and then run it.
@ECHO OFF
set PATH=c:\MapServer\\cgi-bin; C:\MapServer\tools\gdal-ogr; C:\MapServer\\tools\mapserv; C:\MapServer\tools\shapelib; C:\MapServer\proj\bin; C:\MapServer\tools\shp2tile; C:\MapServer\tools\shpdiff; C:\MapServer\tools\avce00;echo GDAL, mapserv, PROJ, and shapelib dll paths set
set GDAL_DATA=C:\MapServer\gdaldata
echo GDAL_DATA path set
set GDAL_DRIVER_PATH=C:\MapServer\gdalplugins
echo GDAL_DRIVER_PATH set
set PROJ_LIB=C:\MapServer\proj\nad
echo PROJ_LIB set
:ALL_DONE
6. Right click the C:\MapServer folder, go to the security tab and add the IIS_IUSRS account with Read & execute permissions.
7. In IIS create a new Website. I called mine Mapping and turned off the default Website. To get CGI working I used the instructions from here.
9. In the Mapping website add a virtual directory (I called mine "cgi") and set the physical path to C:\MapServer\cgi-bin.
10. Select the newly created cgi virtual directory and select the "Handler Mappings" icon in the Feature view. Click the Edit Feature Permissions link in the action menu and check the box "Execute".
11. If you now navigate to http://localhost/cgi/mapserv.exe you should see the message:
No query information to decode. QUERY_STRING is set, but empty
which means you map server is up and running.
12. To try out a demo, I created C:\MapServer\apps\Sample directories and then added the example1-1.map file from "MapServer Itasca Demo Application". I also added a Data directory inside sample and added states_ugl.dbf, states_ugl.shp and states_ugl.shx into it. The paths in example1-1.map file needed to be updated to point to the right locations and then you can browse to it using
http://localhost/cgi/mapserv.exe?map=C:/MapServer/apps/sample/example1-1.map&layer=states&mode=map
Hopefully these instructions may help somebody out. There maybe security issues with this setup so its up to you to figure it out and fix them.