HowTo:  Install the JavaScript API for use with ArcGIS 10.2 for Server

相关信息
Article ID: 42138
Software:
ArcGIS API for JavaScript 3.8
ArcGIS for Server 10.2
Platforms:
Windows Server 2008, Windows 7, Server 2008 R2

问题描述
When using ArcGIS for Server in an isolated or secure environment, it may not be possible to access the hosted Esri JavaScript API libraries. This article provides a walkthrough for installing a local copy of the JavaScript API and configuring it for use with ArcGIS 10.2 for Server.
已邀请:

EsriSupport

赞同来自:

解决方案

This document assumes that Microsoft IIS is being used as the web server. If using a different program, some steps may not apply or may be different based on that configuration. Please consult that software’s documentation if needed.

Download and install the JavaScript API

1. Navigate to the
ArcGIS API for JavaScript page.

2. Under the Download section, click the link to the ArcGIS API for JavaScript section of the
Esri Download page.


3. Scroll down to the latest ArcGIS API for JavaScript API release (currently v3.8).



4. Click the 'arcgis_js_v38_api.zip' link and log in with an Esri Global Account username and password.



5. Accept the License Agreement to start the download.


Modify JavaScript files 1. Unzip the contents of the .zip file to a temporarily location.



This may take a few minutes. While not physically large, the .zip file contains approximately 17K files that must be extracted.
2. Copy the arcgis_js_api folder into the web server root folder, typically:


C:\inetpub\wwwroot


Please note in the following two steps, do not include 'http://' with the fully qualified host name as this is already defined in the two files.
3. Open the following file in a text editor:


C:\Inetpub\wwwroot\arcgis_js_api\library\3.8\3.8\init.js
4. Search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with:


<myhost.example.com>/arcgis_js_api/library/3.8/3.8/
5. Open the following file in a text editor:


C:\Inetpub\wwwroot\arcgis_js_api\library\3.8\3.8\js\dojo\dojo\dojo.js
6. Search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with:


<myhost.example.com>/arcgis_js_api/library/3.8/3.8/

Add IIS default document 1. Open IIS and navigate to the Default Web Site. 2. Open the Default Document.


3. Under the Actions heading, click Add.




4. Type init.js as the name value, and click OK.




Init.js should now be listed as a Local Entry Type default document.


Edit ArcGIS services 1. In a web browser on the server navigate to the following location:
http://localhost:6080/arcgis/a ... ctory
2. Login with administrator credentials.




3. Copy or take a screenshot of the current Services Directory settings in case it is necessary to revert to the default settings.

4. Click 'edit' to modify settings.




5. Replace each of the following fields with the path to the local installation of the JavaScript API using the fully qualified host name in place of the following examples:

• Javascript API URL:


http://myhost.example.com/arcg ... /3.8/
• Javascript API CSS URL:


http://myhost.example.com/arcg ... a.css
• Javascript API CSS2 URL:


http://myhost.example.com/arcg ... i.css






If your server is configured to use HTTPS only, modify the examples above to use HTTPS instead of HTTP as the URL connection.

6. Clear the browser cache to complete installation.


To confirm that ArcGIS for Server is using the correct settings for the JavaScript API, open a web debugging program and preview a map service using the ArcGIS JavaScript viewer from the Services Directory (REST). If configured correctly, the viewer should load successfully and all URLs listed in the web debugger are from the local web server and not from 'serverapi.arcgisonline.com'



其它相关参考
  1. Get the ArcGIS API for JavaScript


创建及修改时间
Created: 1/3/2014

Last Modified: 6/26/2014
原文链接
http://support.esri.com/en/kno ... 42138

要回复问题请先登录注册