AnsweredAssumed Answered

Using Geoprocessing in a service cause exception.

Question asked by Guoooo on Jul 23, 2017
Latest reply on Jul 25, 2017 by YLiu-esristaff

I 've created a Toolbox tool in ArcMap. It's a very simple tool designed to clip raster data. It works fun in ArcMap. And I used it in a console application. Here is the code:

ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
Geoprocessor gp = new Geoprocessor();
gp.AddToolbox(@"D:\Documents\ArcGIS\clipEnvelope\clipService.tbx");
gp.OverwriteOutput = true;
string rectangle = "94736.18 17841.65 97550.74 20512.60";
IVariantArray parameters = new VarArrayClass();
parameters.Add(rectangle);
gp.Execute("clipRaster", parameters, null);

The tool receive a envelope as parameter and "rectangle" in the code represent a envelope. The code works fun in console application. I used the same code in a ASP.NET Web application. And I received a COMException at the row "gp.Execute("clipRaster", parameters, null);".
Here is the detail of the exception:

用户代码未处理 System.Runtime.InteropServices.COMException
HResult=-2147417851
Message=The server threw an exception。 (Exception from HRESULT:0x80010105 (RPC_E_SERVERFAULT))
Source=ESRI.ArcGIS.Geoprocessing
ErrorCode=-2147417851
StackTrace:
在 ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel)
在 ESRI.ArcGIS.Geoprocessor.Geoprocessor.Execute(String name, IVariantArray parameters, ITrackCancel trackCancel)
在 TINServiceTest.TINService.HelloWorld() 位置 d:\VS workspace\TINServiceTest\TINServiceTest\TINService.asmx.cs:行号 41
InnerException:

 

I am developing a ASP.NET Web application. So how can I solve the problem? I would be very grateful for the help.

Outcomes