Select to view content in your preferred language

Web Service Can't Execute Custom Tool

597
3
05-10-2011 06:10 AM
BillMacPherson
Regular Contributor
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
0 Kudos
3 Replies
RichardWatson
Deactivated User
I assume that the web service is not running using the same account that you use interactively.  If that is the case then perhaps you have a permission issue.
0 Kudos
BillMacPherson
Regular Contributor
rlwatson, I appreciate your reply. As you suggested, I gave the folder that holds the toolbox all the permissions possible. It didn't make a difference.

I gave the ASP.net and IIS guest accounts Admin permissions and this also made no difference.

Please, any other suggestions would be greatly appreciated.

Bill
0 Kudos
RichardWatson
Deactivated User
If it is a permission issue then I don't have a clue as to what the issue is.  The only thing that I know to do is to dig through the various log files.

I am not sure how to do it but one idea would be to see if you can have your web service run using your interactive account.  I am not suggesting that you deploy this way but merely implying that if it works then you have more information.

To give an example (not IIS specific), many times services run using the System account.  The System account is very powerful on the local machine but has no priviledges to access information on the network.
0 Kudos