在本地部署离线ArcGIS JavaScript API的Library和SDK,以II7为例和ArcGIS Server(Java)
离线ArcGIS JavaScript API包的下载地址为http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_faq.htm中的ArcGIS API for JavaScript download page。下载需要注册账号,否则无法下载。
下载完毕后,解压Library和SKD,arcgis_js_api(里面包含Library和SKD)拷贝到C:\inetpub\wwwroot目录下。修改C:\Inetpub\wwwroot\arcgis_js_api\library\2.1\arcgis\
js目录下的\esri\esri.js、
\dojo\dojo\dojo.xd.js、
\dojo\dojo\dojo.xd.js.uncompressed.js的“[HOSTNAME_AND_PATH_TO_JSAPI]”为
“<myserver>/arcgis_js_api/library/2.1/arcgis/”,<myserver>为计算机名字。同样的,
C:\Inetpub\wwwroot\arcgis_js_api\library\2.1\arcgis_compact\
js
目录下的\esri\esri.js、\dojo\dojo\dojo.xd.js、
\dojo\dojo\dojo.xd.js.uncompressed.js的“[HOSTNAME_AND_PATH_TO_JSAPI]”为
“<myserver>/arcgis_js_api/library/2.1/arcgis_compact/”,<myserver>为计算机名字。
打开IIS,将arcgis_js_api转为应用程序,并在IIS的功能中选择默认文档,添加Default.ashx为起始页面配置。
至此,arcgis_js_api部署完毕。
接下来配置ArcGIS Server rest,打开“ArcGIS安装地址\java\web_output\rest\WEB-INF\classes\resources”,用文本打开rest-config。找到JS API URLs,修改其下的配置:
jsapi.arcgis=http://serverapi.arcgisonline.com/jsapi/arcgis?v=1.2
jsapi.arcgis.sdk=http://resources.esri.com/arcgisserver/apis/javascript/arcgis
jsapi.arcgis.css=http://serverapi.arcgisonline.com/jsapi/arcgis/1.2/js/dojo/dijit/themes/tundra/tundra.css
jsapi.arcgis.https=https://serverapi.arcgisonline.com/jsapi/arcgis?v=1.2
jsapi.arcgis.css.https=https://serverapi.arcgisonline.com/jsapi/arcgis/1.2/js/dojo/dijit/themes/tundra/tundra.css
改为:
jsapi.arcgis=http://主机名/arcgis_js_api/library/2.1/arcgis/
jsapi.arcgis.sdk=http://resources.esri.com/arcgisserver/apis/javascript/arcgis
jsapi.arcgis.css=http://主机名/arcgis_js_api/library/2.1/arcgis/js/dojo/dijit/themes/tundra/tundra.css
jsapi.arcgis.https=https://主机名/arcgis_js_api/library/2.1/arcgis/
jsapi.arcgis.css.https=https://主机名/arcgis_js_api/library/2.1/arcgis/js/dojo/dijit/themes/tundra/tundra.css
重启ArcGIS Server,完成。
PS:如果部署在内网的话,不能使用主机名,必须使用IP,这样的话,才能够正确访问!