billm889

Web Service Can't Execute Custom Tool

Discussion created by billm889 on May 10, 2011
Latest reply on May 13, 2011 by rlwatson
I have a .Net web service that runs a custom ArcToolbox model. It works fine when running from the .Net IDE. But, when I publish the web service and run it from a browser, the GP.Execute call fails. Any ideas why this fails once the web service is published?

The error message is
Error HRESULT E_FAIL has been returned from a call to a COM component.

    Private Sub TestCustomGPModel()

        Dim GP As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor
        Dim pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult

        Try
            Try
                GP.AddToolbox("C:\mySimpleToolbox.tbx")
            Catch ex As Exception
                Throw New Exception("Can't find toolbox.")
            End Try

            Dim parameters As IVariantArray = New VarArrayClass()

            Dim strToolName As String = "mySimpleModel"
            Try
                pResult = GP.Execute(strToolName, parameters, Nothing) ' *** Error here
            Catch ex As Exception
                Throw New Exception("Error executing tool.")
            End Try

        Catch ex As Exception
            Throw New Exception(ex.Message)
        Finally
            GP = Nothing
            pResult = Nothing
        End Try
    End Sub

Outcomes