• 运行《WebGIS之OpenLayers全面解析》中的示例程序时,无法加载*.json文件。

查看到提示如下错误:GET http://localhost:11232/demos/data/geolocation-orientation.json 404 (NOT FOUND)

原因:

IIS服务器设置问题

1.Open IIS Manager

2.Display properties for the IIS Server

3.Click MIME Types and then add the JSON extension:

File name extension: .json

MIME type: application/json

4.Go back to the properties for IIS Server

5.Click on Handler Mappings

Add a script map

Request path: *.json

Executable: C:\WINDOWS\system32\inetsrv\asp.dll

Name: JSON

参考网址:

http://stackoverflow.com/questions/15944311/error-404-3-not-found-for-json-file

  • 无法加载kml文件

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:11232/demos/data/kml/2012_Earthquakes_Mag5.kml

在IIS中添加:KML 文件的 MIME 类型application/vnd.google-earth.kml+xml

  • 无法加载geojson文件

在IIS中添加:geojson文件的 MIME 类型application/geojson

或者在web.config文件下添加:

<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".geojson" mimeType="application/geojson"/>
    </staticContent>
  </system.webServer>

  • 无法加载gpx文件

在IIS中添加:gpx文件的 MIME 类型application/gpx

相关文章:

  • 2022-12-23
  • 2021-09-07
  • 2021-04-21
  • 2022-12-23
  • 2021-07-05
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-02
  • 2021-07-28
  • 2021-06-24
  • 2022-12-23
  • 2021-05-01
  • 2021-04-01
相关资源
相似解决方案