Authorize License by code

2063
5
06-09-2014 12:07 PM
IsraelUrquieta
New Contributor
Hello,

I have a question, I need authorize ArcGIS Desktop and ArcGIS Server, version 10.2, but by code. This is my code:


                IAuthorizeLicense aoAuthorizeLicenseClass = new AoAuthorizeLicenseClass();

                string path = @"C:\License\Desktop_Basic_268138.eslf";

                aoAuthorizeLicenseClass.AuthorizeASRFromFile(path, this.asrItem.Password);
                   
                string featuresAdded = aoAuthorizeLicenseClass.FeaturesAdded;



No error and exception is threw. So, the license should be applied, but, when I start ArcMap, for example, it it not licensed.

I also use the command line to use the SoftwareAuthorization.exe, this command:

>SoftwareAuthorization.exe /LIF "C:\License\Desktop_Basic_268138.eslf" /s

But nothing happen, no error is displayed. Also, I don't know how to pass the password like the wizard ask for it if I used this software.

Please, let me know any idea or suggestion to implement, or what I'm doing wrong.

Thanks in advance for your help.
0 Kudos
5 Replies
RobertMaddox
New Contributor III
No error and exception is threw. So, the license should be applied, but, when I start ArcMap, for example, it it not licensed.


If I'm reading this correctly, it looks like you're somehow trying to write code that would make ArcMap be licensed. That is not what IAuthorizeLicense is for, rather it is for authorizing a standalone ArcGIS Engine Runtime application that is installed without requiring ArcMap to be installed. It's a completely different license.

IAoInitialize on the other hand is intended to be used when you have ArcGIS Desktop installed and licensed. There's also a whole separate way that objects can be created by ArcGIS Server and used within your application without having to have a separate license, but that requires completely different code in the application to be able to use ArcGIS Server in that way.

From what it sounds like to me, you're trying to run an unlicensed (or unconfigured) copy of ArcMap. ArcMap won't piggyback the license from another assembly. The license for ArcMap must be configured within ArcGIS Administrator on the client machine, not from within code.
0 Kudos
IsraelUrquieta
New Contributor
Hi,

Thanks for you replay. But, yes we can authorize also ArcGIS Desktop with this code.

I could not replay this thread 'cause I was busy. But the solution is:

- Install the ArcGIS Desktop with the parameter of SOFTWARE_CLASS=Editor, if we can authorize the ArcGIS Desktop Standard, for example. And also the SEAT_PREFERENCE=Fixed. And then I was able to authorize my ArcGIS Desktop by code.

I hope this could be useful for some one else.

Thanks again to reply this thread.

Regards,

Israel.
0 Kudos
RobertMaddox
New Contributor III
Hi Israel, I must be misunderstanding something. SEAT_PREFERENCE=Fixed causes ArcMap to use a Single Use license. And in that situation the license can only be used on one machine. So what is the purpose of trying to set that in code? If you are trying to make it so that you can use the same license on multiple machines, that would be a violation of the terms of use. If you are trying to simply register the license file that you're supposed to be using on the machine, why would you need to write code to do that when you can just use ArcGIS Administrator or a script to run SoftwareAuthorization.exe like you mentioned in your first post?

I'm not accusing you or anything, just confused about how and why you would want to use ArcObjects code for this.
0 Kudos
IsraelUrquieta
New Contributor
Hi Robby,

Well, I understand what you say. But, I work on a company partner with ESRI, and we have licenses for Single Use for ArcGIS Desktop, we extend this app. So, we need apply licenses in background. There is nothing illegal.

Thanks for your concern.

Regards,

Israel
0 Kudos
RobertMaddox
New Contributor III
Hi Israel,
Again, I wasn't accusing you or anything. I just obviously don't understand what you're trying to do or why. English is obviously not your native language and the broken sentences make it difficult to understand what you were trying to do. It's no problem though. I'm just glad you were able to do whatever it is you were trying to do.

Peace 😉
0 Kudos