Moment For Technology

Arcgisforjs SDK, API using iis deployment

Posted on Aug. 6, 2022, 1:47 a.m. by Simon Rose
Category: The front end Tag: The front end

1. Download the SDK and API from the official website

  • Register an ArcGIS online account
  • Login developers.arcgis.com/downloads/ download the SDK and API documentation

2. Add a website or directory to IIS

  • Open IIS right click site and select Add Site
  • Fill in the website name such as ArcGISForjsapi4.16
  • Physical path Fill in the corresponding path such as D:\SDK\arcgis_js_v416_api\arcgis_js_api\library\4.16
  • Port Number Enter the corresponding port number, for example, 8080
  • Click ok

3. Change the paths in the init.js and dojo.js files

  • Open the init.js and dojo.js files with notepad++
  • Search HOSTNAME_AND_PATH_TO_JSAPI
  • Replace the baseUrl address with your API deployment address, thus completing the API local deployment
https://[HOSTNAME_AND_PATH_TO_JSAPI]dojo
http://localhost:8080/dojo
Copy the code
  • The deployment results are as follows:

4. The SDK deployment

  • Right-click on the Default Web Site to add a virtual directory
  • Enter the corresponding alias and physical path such as arcgisForjs4.16 and D:\SDK\arcgis_js_v416_sdk\arcgis_js_api\ SDK
  • Click OK to complete the SDK deployment
  • The browser enter localhost/arcgisforjs4.16 again, the results are as follows:

5. API Settings across domains

  • Click the HTTP response header for IIS
  • Add the following three items:
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Methods:GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:*
Copy the code
Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.