Run script tools on server without ArcGIS installed?

1226
3
Jump to solution
03-15-2018 07:21 AM
MollyFoley
Regular Contributor

I'm thinking this isn't possible as the ArcPy library accesses the ArcGIS application to run geoprocessing tools, but I'm asking anyway. We're publishing a web application to a web server that does not have ArcGIS installed on it. This web application runs a python script that utilizes ArcPy. Ideally, we'd like to keep the web server free of an ArcGIS installation, but I don't know how to run arcpy-centric scripts without it installed. Anybody have any ideas?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Molly,

Yes, the web server will need to access the arcpy module in order to execute the script.  Are you able to add the script to a toolbox and publish as a Geoprocessing Service?  You could then make a call to the Geoprocessing Service to execute the script.

View solution in original post

0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Molly,

Yes, the web server will need to access the arcpy module in order to execute the script.  Are you able to add the script to a toolbox and publish as a Geoprocessing Service?  You could then make a call to the Geoprocessing Service to execute the script.

0 Kudos
MollyFoley
Regular Contributor

I'm not sure I can use a Geoprocessing service. The web application is written in .NET, inside the .NET code I call the python script and it runs. Can you call Geoprocessing services from .NET?

            //Set up Habitat Classification script
            IGeoProcessorResult result;
            IGeoProcessor2 gp = new GeoProcessor() as IGeoProcessor2;
            string tlbxPath = Server.MapPath("~/ArcToolbox/HabitatMon.tbx");
            gp.AddToolbox(@tlbxPath);
            IVariantArray parameters = new VarArray();
            string HB_dbConFile = Server.MapPath("~/SDE_DBConnectionFiles/HbTest.sde");
            string FA_dbConFile = Server.MapPath("~/SDE_DBConnectionFiles/Focal.sde");
            parameters.Add(HB_dbConFile);
            parameters.Add(FA_dbConFile);
            parameters.Add(geodatabase);

            //Run Habitat Classification script
            try
            {
                result = gp.Execute("HabitatClassification", parameters, null);
            }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
GhislainPrince
Esri Contributor

arcpy is a library which provides a python api for the following ArcGIS products : Engine, Desktop, Server, ArcGIS Pro.

arcpy comes with the previously mentioned products. you cannot use the arcpy library on a machine without one of those products being installed on that machine.