[Mapserver-users] WMS Client on IIS with MS_MAPFILE variable problem

Daniel Morissette morissette at dmsolutions.ca
Thu Jul 31 13:19:46 EDT 2003


Here are two more suggestions:

1- Try setting MS_MAPFILE globally in your server to a relative path, 
e.g.  MS_MAPFILE = local.map
  then create one scripts directory per WMS service.  Each directory 
will contain only a copy of mapserv.exe plus the local.map for that WMS 
service.  When you access mapserv.exe in each script directory it will 
load the local.map in that directory since MS_MAPFILE is a relative path.

2- If you are setup to compile mapserv.exe you could produce custom 
executables for each WMS service in which you would hardcode the mapfile 
path.

3- A better long-term solution could be to enhance mapserv.exe so that 
if you rename it to for instance mywms1.exe then it looks for a mapfile 
with the same basename (mywms1.map) in a directory specified using an 
environment variable such as MS_MAPFILE_PATH.  So to setup a new WMS 
service you would simply make a copy of mapserv.exe under the name of 
the new WMS service in your scripts directory.

Daniel



David Graham wrote:
> Hi everyone:
> 
> Here is a tricky one, perhaps someone has solved this problem.  I am no 
> IIS expert, so there may yet be a simple solution to this.
> 
> We have some WMS serviers running on Linux and they work fine.  I have 
> hidden the map file with a shell script as suggested in the WMS Server 
> documentation.
> 
> [root at commerce1 cgi-bin]# more i3_demo
> #! /bin/sh
>   MS_MAPFILE=/var/www/wms.i3.com/mapfiles/i3demo.map
>   export MS_MAPFILE
>   /var/www/wms.i3.com/bin/mapserv3.7
> 
> And it works great.
> 
> I now need to perform the same functionality on Windows 2000 using IIS. 
> I searched around to see if I could set an environment variable to be 
> associated with a given script(exe) but could not find a reference or 
> dialog box to set anything.
> 
> I then tried windows scripting. I used cscript.exe to execute the 
> following jscript script.
> 
> [dave at solar dave]$ more i3image.js
> var WshShell = WScript.CreateObject("WScript.Shell");
> var WshSysEnv = WshShell.Environment("SYSTEM");
> WshSysEnv.Item( "MS_MAPFILE" ) = 
> "N:\\wms_data\\mapfiles\\wms1\\i3_Imagery_wms_service.map";
> WshShell.Run( "C:\\Inetpub\\wwwroot\\wms\\wmsserver.exe", 0, true );
> 
> Then I set the IIS to map an empty file I labled wms.i3image to
> C:\WINNT\cscritpt //Nologo <pathto>\i3image.js
> 
> After setting up some permissions, this executed but I have no results.
> 
> The problem is that the script spawns a new shell and send the output to 
> that shell which is then not related back to IIS.
> 
> It also accured to me that the new shell might not even have the 
> inherited the CGI environment, but I have not tested that either.
> 
> So my question is has anyone cracked this problem?   I know I could 
> probably do it in perl or python, but I would rather avoid putting 
> another package on the system just for a script this small.  This is 
> supposed to be the first in a bank of machines that will run only 
> Mapserver WMS services with no other applications installed.  The idea 
> is to minimize the amount of software and thus reduce the degredation of 
> the Windows system.
> 
> By the way Windows is a prerequisit since we will be serving up a lot of 
> data that is compressed in ECW format.
> 
> So if anyone can give me suggestions on how to make this work with 
> Windows 2000 provided technology I would greatly apreaciate it.
> 
> Thanks
> 
> Dave Graham
> 
> 




More information about the mapserver-users mailing list