Javascript 服务器上承载的ASP.net mvc应用程序无法加载铯映射资源
我们有一个MVC应用程序,其中我们通过互联网使用铯地图,一切正常,但现在我们在本地使用地图。本地映射似乎与deve环境(visualstudio)配合使用,但在宿主应用程序时无法加载某些资源。 浏览器控制台中出现以下错误:- localhost/MyApp/Scripts/Cesium/Assets/approximatterrainheights.json加载资源失败:服务器响应状态为404(未找到) localhost/MyApp/Scripts/Cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json未能加载资源:服务器以404状态响应(未找到) 下面是代码片段Javascript 服务器上承载的ASP.net mvc应用程序无法加载铯映射资源,javascript,asp.net-mvc,cesium,Javascript,Asp.net Mvc,Cesium,我们有一个MVC应用程序,其中我们通过互联网使用铯地图,一切正常,但现在我们在本地使用地图。本地映射似乎与deve环境(visualstudio)配合使用,但在宿主应用程序时无法加载某些资源。 浏览器控制台中出现以下错误:- localhost/MyApp/Scripts/Cesium/Assets/approximatterrainheights.json加载资源失败:服务器响应状态为404(未找到) localhost/MyApp/Scripts/Cesium/Assets/IAU2006_
var localMap = Cesium.createTileMapServiceImageryProvider({
url: Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
});
var esri = new Cesium.ArcGisMapServerImageryProvider({
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
});
// Creating Cesium Viewer Object
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider: localMap,
resolutionScale: 0.5,
baseLayerPicker: false,
timeline: false,
navigationHelpButton: false,
animation: false,
infoBox: false,
sceneMode: Cesium.SceneMode.SCENE3D,
sceneModePicker: false,
selectionIndicator: false,
homeButton: false,
geocoder: false
/*contextOptions: {
webgl: {
failIfMajorPerformanceCaveat: false
}
}*/
});
我读过很多文章,我知道在MVC中路由是如何工作的,在其他情况下,我调用控制器操作时使用的是Url.Action(),类似于:-
@Html.Hidden("URL_GetTileJson", Url.Action("GetTileJson", "JsonController"))
但当我为上述错误尝试类似的解决方案时,它也不起作用
任何帮助/建议都将不胜感激默认情况下,IIS不会提供它无法识别的文件扩展名。在本例中,您需要为.json文件添加映射。将以下配置添加到应用程序的web.config文件(合并到现有配置中)
在Cesium存储库中,我们有一个示例web.config,其中包含一个更大的有用文件扩展名和mime类型列表:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>