2

I tried to connect WMS from my MapServer 7.0.4 in QGIS 2.18.3 (QGIS 2.10.1 too) but it failed with error:

Map request error (Status: 200; Response: <HTML>
            <HEAD><TITLE>MapServer Message</TITLE></HEAD>
            <!-- MapServer version 7.0.4 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
            <BODY BGCOLOR="#FFFFFF">
            msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed.
            </BODY></HTML>; Content-Type: text/html; URL:http://192.168.0.127/mapserver/scripts/mapserv.exe?map=D:\MapServer\map\wmstest.map?&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=-422441,-1246470,-419074,-1245430&SRS=EPSG:2065&WIDTH=1302&HEIGHT=403&LAYERS=ulice&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE)

I think there is a problem with "?" in a request GetMap. A correct one should be:

...wmstest.map&SERVICE=WMS....

and QGIS make a link:

...wmstest.map**?**&SERVICE=WMS....

Here is my link for connecting WMS (not accessible from internet):

http://192.168.0.127/mapserver/scripts/mapserv.exe?map=D:\MapServer\map\wmstest.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities

Can someone explain me?

my map file contents:

"wms_onlineresource" "http://192.168.0.127/mapserver/scripts/mapserv.exe?map=D:\MapServer\map\wmstest.map?"

I tried it without "?" at the end, but it didn't work. A request GetMap works fine in my browser (without that "?").

4
  • you could use an environment variable to set the map file location to avoid this
    – Ian Turton
    May 31, 2017 at 8:39
  • I would rather suspect wrong configuration in the mapfile. What do you have in "wms_onlineresource"?
    – user30184
    May 31, 2017 at 8:50
  • I made a test with QGIS 2.18.7 with same kind of setting and it does work for me. Delete your old connection, make sure to have "wms_onlineresource" "http://192.168.0.127/mapserver/scripts/mapserv.exe?map=D:\MapServer\map\wmstest.map" and use the same URL for connecting your server. A workaround that you should not need to use is to check the Ignore GetMap/GetTile URI reported in capabilities.
    – user30184
    May 31, 2017 at 9:40
  • ? is correct it separates the endpoint of the service from the query parameters, such as map=&, request=GetMap&, ...
    – nmtoken
    Jun 5, 2017 at 10:54

1 Answer 1

2

Thank you for help, it works now. I deleted old connection and use http://192.168.0.127/mapserver/scripts/mapserv.exe?map=D:\MapServer\map\wmstest.map for connecting my MapServer. I edited wms_onlineresource too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.