exeGesIS Spatial Data Management

 

Getting MapServer to work on IIS7.5 Server 2008

Text below is reproduced from: http://mas-kono-tes.blogspot.com/2011/03/getting-mapserver-to-work-on-iis75.html and gives a reasonable overview of how to install mapserver - especially how to navigate IIS 7 menu options.

and CGI install: http://blogs.iis.net/thomad/archive/2010/04/04/how-to-run-a-cgi-program-under-iis-7-0-or-iis-7-5.aspx

Note:  setting paths and env variables is not normally necessary and in fact can be dangerous on systems hosting multiple versions of mapserver  or related applications.

Getting MapServer to work on IIS7.5 Server 2008

For some reason there doesn't seem to be a lot of documentation on how to install MapServer on IIS7 +. This entry will only cover installation on Windows Server 2008 R2 SP1 (x64) with IIS 7.5.


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

3. Get the MS4W zip file (ms4w_3.0.1.zip)and extract it to the root directory, (i used C:\ms4w)

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.

 

8. In IIS click on the machine node and select the "ISAPI/CGI restrictions" icon from the Feature view. Select Add and choose C:\MapServer\cgi-bin\MapServ.exe as the "ISAPI or CGI path" and tick the check box for "Allow extension path to execute".

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.

Comments

https://www.esdm.co.uk/getting-mapserver-to-work-on-iis75-server-2008