Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to publish an arcobjects C# executable as a gpservice. We did this in 10.0 by adding it to a toolbox and hitting publish. Using ArcCatalog in 10.1 you must first run the script before you can 'Share as a Geoprocessing Service'.

I've run the GP tool successfully and have tried both 'Publish to Server' and 'Save as a Service Definition' file. It won't let me go any further though. It comes back with Script Syntax Error Line: 1 - which leads me to believe it is trying to parse the executable as a python script.

Does anyone know how to overcome this? And better yet is there any way to publish a GP service without running it first?

share|improve this question
    
I've got someone from Esri support helping me with this, this week. I'll post the solution or workaround when/if one is found. –  dubvfan87 Jun 26 '12 at 13:12

3 Answers 3

As a worst case you could wrap it in Python, call the executable with a subprocess in the wrapper, and publish the wrapper as a GP service.

share|improve this answer
1  
That would certainly work. We found a way to get around 'Share as Service'. You can just create a dummy python script that takes in your params and then replace the script after it is published as a GP service. The published script will be in: .../directories/arcgisoutput/arcgisinput/... –  dubvfan87 Jun 26 '12 at 13:15
up vote 1 down vote accepted

Well here is the response I got from Esri tech support:

Hi Matt,
I tested on my side and confirmed that .exe file is no long supported as to publish as a GP tool.
I've attached the error information I got when trying to publish a .exe file as a GP tool.

It seems that in 10.1 you have to reproduce your code in a python script code to publish the tool to your Server.
I'm sorry for all the inconvenience this will bring.
Let me know if you have any further question.
Regards,

Esri Tech

Solution:

Wrap the exe file in its own toolbox and call the the toolbox from another python script in a toolbox. So you need 2 toolboxes one with the python wrapper and the other with exe gp tool. Use the import toolbox function in the wrapper python script.

share|improve this answer

Admittedly a bit 'hacky' - I've used this approach with great success.

Basically, I just create a dll (via Class Library project in visual studio) that encapsulates all of my ArcObjects needs. I then add a reference to that dll using Python.NET and it works more or less like native python class.

share|improve this answer
    
Interesting, I've never considered IronPython with ArcObjects. I think we are a bit C# committed at this point though. –  dubvfan87 Jul 11 '12 at 20:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.