Providing geoscience data globally Navigation
Main content
Bottom links


Home > How to serve a OneGeology WMS > Setting up a MapServer WMS > MapServer and IIS 6

4.4 Alternative MapServer configurations

4.4.1 MapServer and IIS 6

If you have an existing Microsoft Windows server running IIS, you may use this web server instead of Apache to run the MapServer CGI. This section runs through how you may achieve this to create a service URL that almost exactly mirrors that which we have configured using Apache. The configuration allows maximum reuse of code to improve maintenance, (such as future updates to support newer WMS specifications). It is slightly convoluted and requires an advanced knowledge of IIS administration.

To achieve this we need a version of MapServer that has been compiled to run on a Windows platform, and the simplest way of getting this is to use the MapServer binaries that come with the MS4W zip file; specifically we need the contents of the ms4w\Apache\cgi-bin folder.

The folder structure used in the example show best practice of separating executable content from static content, you may change the folder structure, and folder naming, as appropriate to fit your server structure, but virtual directory mappings need to be retained. Folder structure and naming are shown in the below figure. In this example the "IIS-service" folder is mapped at the root of D:\, but can exist at any location on your web server or indeed on any server that can be mapped to from your web server.

IIS folder structure

Quickly running through this structure, you need to know that all the MapServer CGI files are held in the "cgi-bin" folder (and sub-folders), and all files concerning the WMS service are held in the "MSfiles" folder and (sub-folders); only the index HTML file is physically held in the "wwwroot" folder. The example shows the setup for the exemplar WMS, and the "BGS_Bedrock_and_Superficial_Geology" folder in "APPS" is a direct copy of the "c:\ms4w\apps\BGS_Bedrock_and_Superficial_Geology" folder from the example zip. Finally, there is no content in the "d:\IIS-service\MSfiles\dummy-cgi\ BGS_Bedrock_and_Superficial_Geology" folder, it exists only as a mechanism to map to the cgi-bin folder within IIS; this mapping mechanism further allows us to map to a single copy of the MapServer CGI binaries, if we need to serve more than one WMS service.

We will now show you how to map these folders in IIS to create the appropriate virtual directories (effectively, the directory structure that a user would see when they access the service). The resultant directory mappings are shown in the below figure from the IIS manager console.

IIS console showing web service configuration

Our IIS service has no other content running on it, but this may not be your starting point. We start by mapping our "Home Directory" to "D:\IIS-service\wwwroot" and copying the contents from "c:\ms4w\Apache\htdocs" to it from the exemplar zip file.

Next we map a virtual directory "cgi-bin" to the folder "D:\IIS-service\cgi-bin" and give it "Scripts and Executables" permissions. This folder does not need Read or Write permissions.

We now map a virtual directory "BGS_Bedrock_and_Superficial_Geology" within the "cgi-bin" virtual directory to the folder "D:\IIS-service\MSfiles\APPS\dummy-cgi\BGS_Bedrock_and_Superficial_Geology". Similarly to the "cgi-bin" folder this virtual directory, needs "Scripts and Executables" permissions, but doesn’t need Read or Write permissions.

We now create another virtual directory "wms" within the above "BGS_Bedrock_and_Superficial_Geology" virtual directory and map it back to our physical folder "D:\IIS-service\cgi-bin". Again we set "Scripts and Executables" permissions, but deny Read and Write. We enable a default content page and set this page to be:


In effect we have now created a path (as below) to our exemplar service, which hides both the structure of our server and the software we are using to serve our WMS.


However at this stage in the setup IIS security will not allow you to run MapServer from this (or any other) URL. To configure this we must "Add a new Web service extension" which we will call "wms", with required file "d:\IIS-service\cgi-bin\mapserv.exe" and set status to "Allowed". If you are setting up more WMS services you do not need to repeat this stage.

You can now test the MapServer installation with the below URL, and should get a message like "No query information to decode. QUERY_STRING is set, but empty."


We now create a new virtual directory "BGS_Bedrock_and_Superficial_Geology" within the "wwwroot" directory and map it to "D:\IIS-service\MSfiles\APPS\BGS_Bedrock_and_Superficial_Geology\wwwroot"; we give this only "Read" permission. Then, within this directory, another virtual directory "templates" which maps to "D:\IIS-service\MSfiles\APPS\BGS_Bedrock_and_Superficial_Geology\templates"; again with only "Read" permission.

Our final virtual directory is "ms_img" which we create within "wwwroot" and map to "D:\IIS-service\MSfiles\APPS\ms_tmp\img"; we give this directory "Read" and "Write" permissions.

The final step in the configuration is to change the paths in the exemplar file to reflect our physical folder and virtual directory structure:

SHAPEPATH “D:\IIS-service\MSfiles\APPS\BGS_Bedrock_and_Superficial_Geology\data”
IMAGEPATH “D:\IIS-service\MSfiles\APPS\ms_tmp\img\”
IMAGEURL “/ms_img/”
LOG “D:\IIS-service\MSfiles\APPS\ms_tmp\log\bgsBEDROCK.log”

For details on configuring the remainder of the map file see the MapServer configuration section.

Section last modified: 19 January 2010