一、前期配置
1、开启IIS
控制面板-程序与功能-开启关闭功能
2、其实可以直接使用系统的inetpub作为应用池,但是我们可以新建一个NewWeb文件夹来作为全新的应用池
新建NewWeb文件夹,将权限改为Everyone(不明白自行百度)
3、打开IIS管理器
4、将物理路径设置为NewWeb的物理路径,应用程序池设置为Classic .NET AppPool
5、应用程序池的Classic .NET AppPool的标识改为NetworkService
前期配置完成
二、修改api文件
1、在官网下载api与sdk(先注册一个Esri的账号)
2、按照安装步骤进行修改:(注意最好将https改为http,www.example.com换成localhost,否则可能报错)
将3.24文件夹的
init.js文件中
https://[HOSTNAME_AND_PATH_TO_JSAPI]dojo 替换为
http://localhost/arcgis_js_api/library/3.24/3.24/dojo
dojo.js文件中
https://[HOSTNAME_AND_PATH_TO_JSAPI]dojo 替换为
http://localhost/arcgis_js_api/library/3.24/3.24/dojo
将3.24compact文件夹的
init.js文件中
https://[HOSTNAME_AND_PATH_TO_JSAPI]dojo 替换为
http://localhost/arcgis_js_api/library/3.24/3.24compact/dojo
dojo.js文件中
https://[HOSTNAME_AND_PATH_TO_JSAPI]dojo 替换为
http://localhost/arcgis_js_api/library/3.24/3.24compact/dojo
3、将arcgis_js_v324_api文件夹中的arcgis_js_api文件夹复制到NewWeb中(看清楚是复制arcgis_js_api文件夹),在IIS管理器中浏览init.js文件,如果打开就说明完成api的修改与配置
三:检验是否安装配置成功
1、新建一个html文件,复制以下代码;或者VS新建一个Web页,添加html,复制以下代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Map</title>
<link rel="stylesheet" href="http://localhost/arcgis_js_api/library/3.24/3.24/esri/css/esri.css" />
<script src="http://localhost/arcgis_js_api/library/3.24/3.24/init.js"></script>
<style>
html,
body,
#map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<script>
require([
"esri/map",
"esri/layers/ArcGISTiledMapServiceLayer",
"dojo/domReady!"
], function (Map, ArcGISTiledMapServiceLayer) {
var map = new Map("map");
//If you do not have Internet access then you will need to point this url to your own locally accessible tiled service.
var tiled = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");
map.addLayer(tiled);
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
html文件:
vs中html页面:
2、如果运行可以出现地图,说明安装配置及代码无误,大功告成!
小结:1、如果使用系统自带的inetpub,会省去配置应用程序池很多的事;
2、修改文件也是照着api文件夹中自带的install_api_windows.html修改的,只是稍微做了一点修改,比如https以及www.example.com;
写这篇文章只是因为我照着大神的步骤一步一步来并且成功了,想趁着印象深刻,重温一遍记录下了每一步,大神博客地址是https://blog.csdn.net/lovecarpenter/article/details/52169705