IIS and FastCGI

Howard Butler hobu at IASTATE.EDU
Thu Apr 12 17:33:51 EDT 2007


All,

I have been able to get FastCGI working with IIS and ArcSDE.  Below 
is a description of what I did, and I hope someone can take it and 
turn it into a proper doc once they can confirm that it works for them.

This description is for using just the MapServer CGI with FastCGI and 
IIS (5.1 on my case), not PHP or any of the other bindings, and not 
with Apache.

Ingredients:
- A recent MS4W build that has FastCGI support
- The FastCGI ISAPI module from <http://www.caraveo.com/fastcgi/>
- Frickin' IIS

Step 1)  Get regular old mapserv.exe working.  This can be hard.  It 
was for me.  Liberal use of depends.exe to go find all of the dlls 
you need to give the IUSR account execution permissions might be required.

Step 2) Get it mapserv.exe rendering your data.  Test that you can 
get an image by hitting your URL via WMS 
<http://localhost/cgi-bin/mapserv.exe?map=C:\my\mapfile.map&service=WMS&request=GetMap&version=1.1.1&layers=mylayer>

Step 3)  Put the ISAPI DLL somewhere on your execution path.  Add the 
ISAPI filter by going to your Web Site's Properties page and adding 
it on the ISAPI Filters tab.

Step 4) Go to the properties page of your cgi-bin directory or 
virtual directory in the IIS admin.  Choose "Configuration" and add a 
mapping.  Pick the location of mapserv.exe for your executable and 
choose .fcgi (don't forget the .).  Uncheck Script engine and Check 
that file exists.

Step 5)  Hack your registry with entries so the FastCGI ISAPI 
module.  More information about the options available are in the 
readme.txt of the source version of the ISAPI module.  You could also 
try using the following (after pulling out the email quoting and 
updating the AppPath to reflect the location of your mapserv.exe) and 
save it as a .reg file and load it into your registry.

>Windows Registry Editor Version 5.00
>
>[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI]
>"CustomVars"=hex:00
>"ThreadPoolSize"=dword:00000010
>"BypassAuth"=dword:00000001
>"Impersonate"=dword:00000001
>"StartServers"=dword:00000005
>"IncrementServers"=dword:00000002
>"MaxServers"=dword:00000025
>
>[HKEY_LOCAL_MACHINE\SOFTWARE\FASTCGI\mapserv.fcgi]
>"AppPath"="c:\\inetpub\\cgi-bin\\mapserv.exe"

Step 6) Restart IIS.  You may have already done this multiple 
times.  You may have already restarted your machine multiple 
times.  I'll admit to some significant dead chicken waving to get this to work.

Step 7) Go to your URL, but instead of hitting mapserv.exe, hit 
mapserv.fcgi.  It should return an image to you.  If it complains 
about not finding proj.4 files, you may need to add CONFIG "PROJ_LIB" 
"C:\location\of\proj\data" or CONFIG "GDAL_DATA" "C:\location\of\gdal\data".

Step 8)  add PROCESSING "CLOSE_CONNECTION=DEFER" to all of the layers 
you want connection pooling to work with.  This provides the most 
benefit for drivers with heavy connection overhead like SDE and Oracle.

Good luck,

Howard 



More information about the mapserver-users mailing list