弄了好久的javascript的本地部署,好不容易摸索出来了
1.去csdn上下载javascript4.0beta3版本
2.拷贝arcgis_js_v40beta3_api文件夹下的 arcgis_js_api 到 C:\Inetpub\wwwroot(IIS根目录) 目录下
3.在IIS添加网站,其物理路径设置为C:\inetpub\wwwroot
4.修改C:\Inetpub\wwwroot\arcgis_js_api\library\4.0\4.0\init.js与C:\Inetpub\wwwroot\arcgis_js_api\library\4.0\4.0\dojo\dojo.js ,替换其中的[HOSTNAME_AND_PATH_TO_JSAPI]dojo为serverip:port/arcgis_js_api/library/4.0/4.0/dojo(注意保留dojo)
5、测试是否成功,把里面的www.example.com换成ip:port(这段代码是Install.html里面的,注意要更改底图url变为http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer进行测试,原install里的url打不开)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Test Map</title>
<link rel="stylesheet" href="http://172.18.160.241:8082/arcgis_js_api/library/4.0beta3/4.0beta3/dijit/themes/claro/claro.css" />
<link rel="stylesheet" href="http://172.18.160.241:8082/arcgis_js_api/library/4.0beta3/4.0beta3/esri/css/main.css" />
<style>
html, body, #ui-map-view {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
<script src="http://172.18.160.241:8082/arcgis_js_api/library/4.0beta3/4.0beta3/init.js"></script>
<script>
var myMap, view;
require([
"esri/Basemap",
"esri/layers/ArcGISTiledLayer",
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function (Basemap, ArcGISTiledLayer, Map, MapView){
// --------------------------------------------------------------------
// note that if you do not have public Internet access then you will need to
// use the Basemap class and point this url to your own
// locally accessible cached service.
//
// Otherwise you can just use one of the named hosted ArcGIS services.
// --------------------------------------------------------------------
var layer = new ArcGISTiledLayer({
url: "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
});
var customBasemap = new Basemap({
baseLayers: [layer],
title: "Custom Basemap",
id: "myBasemap"
});
myMap = new Map({
basemap: customBasemap
});
view = new MapView({
center: [-111.87, 40.57], // long, lat
container: "ui-map-view",
map: myMap,
zoom: 6
});
});
</script>
</head>
<body class="claro">
<div id="ui-map-view"></div>
</body>
</html>