+ Reply to Thread
Results 1 to 18 of 18

Thread: Deploying a Custom C# GP-Tool on 10.1 Server

  1. #1
    Johannes Elsinghorst
    Join Date
    Jun 2010
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Default Deploying a Custom C# GP-Tool on 10.1 Server

    Hi there,

    im trying to migrate my 10.0 GP-Services to 10.1
    As stated in http://resources.arcgis.com/en/help/...000008p000000/
    i am supposed to register the dll with 32bit esriregasm as well as with 64bit esriregasm.
    The problem im facing here is that the dll references the ESRI.ArcGIS.ADF assembly for the GPFunctionFactories Class in order to register the factory correctly. Unfortunately there is no ESRI.ArcGIS.ADF MSIL oder 64bit version, its only available as x86 in the GAC thus the 64bit esriregasm fails to register my dll.
    Is there anything im missing here or a workaround for this issue?

    Thanks,
    Johannes

  2. #2
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    HI Johannes,

    At 10.0 the MSIL version for ESRI.ArcGIS.ADF was not available. The ADF available at 10.1 works for 'any cpu' - that is, it works for 32-bit as well as 64-bit. You just need to set the debug mode to 'Any CPU'.

    Could you please tell me what was your project setup at 10.0, especially:
    - Debug mode - 32-bit or Any CPU?
    - Was the reference to ESRI.ArcGIS.ADF set to False?

    The best approach would be to recompile the 10.0 project at 10.1 - if necessary remove the reference to ADF and add it back. Then follow the help doc. Let me know if you face any trouble. Thanks.

    Nobbir, Geoprocessing SDK

  3. #3
    Kirk Kuykendall

    Join Date
    Oct 2009
    Posts
    295
    Points
    3
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    I had the same problem and was able to get the 64 bit version of EsriRegAsm to succeed by removing the reference to ESRI.ArcGIS.ADF, and adding a reference to ESRI.ArcGIS.ADF.Local, and recompiling.

    However, when I go into arcmap and run the tool, then right click to share as a geoprocessing package, it fails.

    I have both arcgis desktop and server installed on the same machine.

    I'm getting an error 00151.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Capture.PNG‎
Views:	89
Size:	6.3 KB
ID:	17564  
    Kirk Kuykendall
    AmberGIS Programming Services
    Now answering questions at http://gis.stackexchange.com

  4. #4
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Let me be clear the steps you have followed.

    1. You have compiled the C# project by removing the reference to ADF and adding it back AND
    - setting the Debug mode to 'Any CPU'.

    2. In order to run the tool in ArcMap you need to register it with the 32-bit EsriRegAsm located at ../Program Files (x86)/Common Files/ArcGIS/bin - if the registration fails then you have some problem with the project settings.

    Assuming step 2 succeeded.

    3: Run the tool in ArcMap. If you want to publish the tool it will fail as the Server does not know about it yet. So, don't publish now until performing step 4.

    4. Register the DLL with the 64-bit EsriRegAsm located at /Program Files/Common Files/ArcGIS/bin folder. If registration succeeds ..

    5. From ArcMap, share the result as a service.

    6. You should now be able to consume the service from any machine whether the DLL is registered with that machine.

    Let me know what error message you get (if any).

  5. #5
    Kirk Kuykendall

    Join Date
    Oct 2009
    Posts
    295
    Points
    3
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Hi NobbirAhmed -

    Here's my results:

    1. You have compiled the C# project by removing the reference to ADF and adding it back AND
    - setting the Debug mode to 'Any CPU'.
    yes

    2. In order to run the tool in ArcMap you need to register it with the 32-bit EsriRegAsm located at ../Program Files (x86)/Common Files/ArcGIS/bin - if the registration fails then you have some problem with the project settings.
    success (I did both 32 and 64 bit esriregasm).

    Assuming step 2 succeeded.

    3: Run the tool in ArcMap. If you want to publish the tool it will fail as the Server does not know about it yet. So, don't publish now until performing step 4.
    successfully ran


    4. Register the DLL with the 64-bit EsriRegAsm located at /Program Files/Common Files/ArcGIS/bin folder. If registration succeeds ..
    Did after step 2.

    5. From ArcMap, share the result as a service.
    Failure - error 00151 after running analyze.

    Click image for larger version

Name:	Capture.PNG
Views:	58
Size:	11.6 KB
ID:	17565
    6. You should now be able to consume the service from any machine whether the DLL is registered with that machine.

    Let me know what error message you get (if any).

    Could you please confirm that these steps work on a machine with both Desktop and server are installed?

    Thanks, Kirk
    Last edited by kirkktx; 09-09-2012 at 05:27 PM.
    Kirk Kuykendall
    AmberGIS Programming Services
    Now answering questions at http://gis.stackexchange.com

  6. #6
    Kevin Hibma

    Join Date
    Oct 2009
    Posts
    692
    Points
    341
    Answers Provided
    43


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    I'm not trying to hi-jack this, only offer advice/questions on the error 151:
    This is a function tool - but have you wrapped it inside a script tool some how? Or are you actually running the function tool?
    Regards,

    Kevin H.
    Esri

  7. #7
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    I'm not trying to hi-jack this
    Kevin, rather, you have chipped in at the right moment.

    Kirk, please check out the help for error 000151 which states "tool or function referenced is not supported for use in ArcGIS Server". The help topic for the error lists a number of tools/functions/scenarios where you may get this error.

  8. #8
    Kirk Kuykendall

    Join Date
    Oct 2009
    Posts
    295
    Points
    3
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Thanks for the fast response !

    I'm not wrapping the tool in a script, do I need to do that?

    I don't see anything in the list for error 00151 that would apply to my tool.
    http://resources.arcgis.com/en/help/...0000009n000000

    The tool takes one argument (a long), and returns one argument (a long).

    For IGPFunctionName.MinimumProduct I'm returning esriProductCodeBasic ... is that correct?

    This worked at 10.0. Any word on whether this use case is supported when both desktop and server are installed on same machine?
    Kirk Kuykendall
    AmberGIS Programming Services
    Now answering questions at http://gis.stackexchange.com

  9. #9
    Kevin Hibma

    Join Date
    Oct 2009
    Posts
    692
    Points
    341
    Answers Provided
    43


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    No, you dont need to do that (and actually shouldnt) - For a second I got my analyzers mixed up and was thinking about another one. Its good you confirmed that though.

    To my knowledge, this analyzer which is impeding your publishing does not break into function tools to inspect them. I'm a little unsure how/why 151 would be thrown on a function tools.

    Is there any chance you could share your compiled tool with us? I'll give it a try here. Again, this is strange, we have a test with a custom tool that does almost exactly what yours does and works without issue.
    I cant comment on the license code, but dont suspect thats an issue, again because this analyzer isn't digging into the tool (I think).

    If you can share the dll, please zip it up and send to me (khibma@esri.com).

    thanks
    Regards,

    Kevin H.
    Esri

  10. #10
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Setting IGPFunctionName.MinimumProduct to esriProductCodeBasic should not fail. I'll try on my side with similar settings.

    Meanwhile, to get going, just return true in your isLicensed method.

    Code:
            public bool IsLicensed()
            {
                return true;
            }
    Also, if possible send your project to Kevin - we'll see.

  11. #11
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Okay, I tried with your project and got the same error you are getting. I then looked into the project itself. The project organization kind of complex to me . So, I created a greatly simplified visual studio project just using your C# file inside the Tools folder (SleeperTool.cs). I can use this tool in Desktop and am able to publish it to ArcGIS Server and can consume the service without any error.

    I have attached my project.

    One question, what is the purpose of the AbstractGPTool class? Cannot you derive your SleeperTool class from IGPFunction2 directly as you did for GPFactory class where you derived the class from IGPFunctionFactory?
    Attached Files

  12. #12
    Kirk Kuykendall

    Join Date
    Oct 2009
    Posts
    295
    Points
    3
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Hi Nobbir -

    Thanks Nobbir! that does indeed work. I may try out why the attached GP tool works in 10.0 but not in 10.1. If I can't, then I'll need to do some re-architecting.

    Kirk
    Attached Files
    Kirk Kuykendall
    AmberGIS Programming Services
    Now answering questions at http://gis.stackexchange.com

  13. #13
    Vasyl Melnychuk
    Join Date
    Jun 2010
    Posts
    12
    Points
    3
    Answers Provided
    0


    1

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Hi Kirk,

    I have faced with the same problem and found solution. I was not able to publish GP Tool in ArcGIS 10.1 (that was working fine in ArcGIS 10.0) till I removed spaces from tool name (I saw in your sample you also have space in name).

    I hope this will help for you too.

    Vasyl

  14. #14
    Brian Coward
    Join Date
    May 2010
    Posts
    28
    Points
    0
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    I've been having this same issue. Has anyone figured out a solution yet? The final post on the thread suggested that by simply eliminating the spaces from the tool name would fix the incompatibility. I haven't had spaces in the folder location of the esriregasm.exe file or the tool name itself. When the term tool is referred to this means a .dll?
    Any ideas or solutions would be appreciated. Thanks,
    Brian

  15. #15
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Hi Brian,

    Could you please let us know what error message you are getting? Is the tool running fine on Desktop? Or faililng on both desktop and server?

    Can you send me your tool or at least the your code files (as *.zip) at nahmed@esri.com ?

    Thanks, Nobbir

  16. #16
    Kirk Kuykendall

    Join Date
    Oct 2009
    Posts
    295
    Points
    3
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Quote Originally Posted by briancoward View Post
    I've been having this same issue. Has anyone figured out a solution yet? The final post on the thread suggested that by simply eliminating the spaces from the tool name would fix the incompatibility. I haven't had spaces in the folder location of the esriregasm.exe file or the tool name itself. When the term tool is referred to this means a .dll?
    Eliminating the spaces in my Name fixed one of my problems (Thanks Vasmel!). (Spaces in DisplayName are ok).

    The other problem I had was that when I publish the gp service to a server from a different machine, the factor was not getting registered in the "Esri GeoProcessor Function Factory" category {FD939A4A-955D-4094-B440-77083E410F41}. To view this, fire up Categories.exe in the bin folder. I ended up copying the source to the server and re-building there, and running EsriRegasm.exe.

    Seems like a bug. I would expect the gp service publisher to register via EsriRegasm. (I'm on 10.11).
    Last edited by kirkktx; 01-13-2013 at 10:05 AM.
    Kirk Kuykendall
    AmberGIS Programming Services
    Now answering questions at http://gis.stackexchange.com

  17. #17
    Nobbir Ahmed

    Join Date
    Jun 2010
    Posts
    327
    Points
    124
    Answers Provided
    17


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    You need to register the DLL on each machine (with Desktop installed) from where you'll publish the tool.

    Also, are you using categories.exe to register the DLL or just to view what's installed?

  18. #18
    Kirk Kuykendall

    Join Date
    Oct 2009
    Posts
    295
    Points
    3
    Answers Provided
    0


    0

    Default Re: Deploying a Custom C# GP-Tool on 10.1 Server

    Quote Originally Posted by NobbirAhmed View Post
    You need to register the DLL on each machine (with Desktop installed) from where you'll publish the tool.

    Also, are you using categories.exe to register the DLL or just to view what's installed?
    I'm calling EsriRegAsm (x86) to register. Using Categories.exe only for viewing.
    Kirk Kuykendall
    AmberGIS Programming Services
    Now answering questions at http://gis.stackexchange.com

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts