Deploying a Custom C# GP-Tool on 10.1 Server

3503
17
07-24-2012 12:14 AM
JohannesElsinghorst
New Contributor II
Hi there,

im trying to migrate my 10.0 GP-Services to 10.1
As stated in http://resources.arcgis.com/en/help/main/10.1/index.html#/Deploying_custom_NET_and_C_tools/005700000...
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
Tags (2)
17 Replies
NobbirAhmed
Esri Regular Contributor
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
0 Kudos
KirkKuykendall
Occasional Contributor III
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.
0 Kudos
NobbirAhmed
Esri Regular Contributor
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).
0 Kudos
KirkKuykendall
Occasional Contributor III
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.

[ATTACH=CONFIG]17565[/ATTACH]
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
0 Kudos
KevinHibma
Esri Regular Contributor
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?
0 Kudos
NobbirAhmed
Esri Regular Contributor
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.
0 Kudos
KirkKuykendall
Occasional Contributor III
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/main/10.1/index.html#//00570000009n000000

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?
0 Kudos
KevinHibma
Esri Regular Contributor
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
0 Kudos
NobbirAhmed
Esri Regular Contributor
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.

        public bool IsLicensed()
        {
            return true;
        }


Also, if possible send your project to Kevin - we'll see.
0 Kudos