HOW TO
ArcGIS Engine 10.0 can be authorized using an offline license file called an ASR file. This is used to authorize ArcGIS Engine version 10.0, Service Pack 1 (SP1) through Service Pack 4 (SP4). There are several steps that must be followed to successfully license Engine 10.0 using ASR files.
Note that ASR files are precursors to ESRI Secure License Files (ESLF). ASR files have an *.asr extension, while ESLFs have an *.eslf extension. The difference between the two is that ASR files were created for ArcGIS 10.0 SP1 through SP4; ESLF files replaced ASR files at 10.0 SP5, and can be used to license Engine at version 10.1 through to the current version.
ESRI.ArcGIS.AoAuthorizer.IAuthorizeLicense aoAuthorizeLicense = new ESRI.ArcGIS.AoAuthorizer.AoAuthorizeLicenseClass(); bool bound = ESRI.ArcGIS.RuntimeManager.Bind(ProductCode.Engine); // Bind to the ArcGIS Engine product string pathToASRLicenseFile = @"C:\temp\SomeASRFile.asr"; string password = "somePassword"; aoAuthorizeLicense.AuthorizeASRFromFile(pathToASRLicenseFile, password); // Authorize using the ASR File //aoAuthorizeLicense.DeauthorizeASRFromFile(pathToASRLicenseFile, password); // Uncomment this to de-authorize string featuresAdded = aoAuthorizeLicense.FeaturesAdded; System.Diagnostics.Debug.WriteLine("Features Added: " + featuresAdded); // check if licensing was successfully done // Check if the Engine Product Code is available ESRI.ArcGIS.esriSystem.IAoInitialize aoInitialize = new ESRI.ArcGIS.esriSystem.AoInitialize(); ESRI.ArcGIS.esriSystem.esriLicenseStatus esriLicense_Status = aoInitialize.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngine); System.Diagnostics.Debug.WriteLine("esriLicenseStatus: " + esriLicense_Status); // either "available" or "unavailable
The above API calls are explained in the Word document: Authorizing ArcGIS 10 Using ASR Files.docx.
In the code above, it can be seen that binding to an ESRI product (ArcGIS Engine) has been done before ArcObjects code is called.
Make sure to add an assembly reference to either Esri.ArcGIS.AoAuthorizer.dll, or AoAuthorizer.dll (these are equivalent dlls), and include a using statement at the top of the class: using Esri.ArcGIS.AoAuthorizer.
Note that if the step to register the two dll files is skipped, an error occurs on the following line of code:
IAuthorizeLicense aoAuthorizeLicense = new AoAuthorizeLicenseClass();
Error: COM Exception was unhandled: Retrieving the COM class factory for component with CLSID {6DBE8BF8-6000-4734-B1A8-C81C69651C06} failed due to the following error: 80040154.
IAoAuthorizeLicense.AuthorizeASRFromFile(pathToASRLicenseFile, password);
IAoAuthorizeLicense.DeauthorizeASRFromFile(pathToASRLicenseFile, password);
Error: COM Exception was unhandled. HRESULT E_FAIL has been returned from a call to COM component.
Note: ASR files work on Windows 7, 8, and 10, on both 32-bit and 64-bit platforms.
Note: Support for ArcGIS Engine 10.0 expired on 01/01/2016 for standard customers. Support for Premium customers expires on 01/01/2018. ESRI recommends that customers move away from ASR files to the new framework, ESRI Secure License Files (ESLF), for ArcGIS Engine versions 10.1 and above.
Get help from ArcGIS experts
Download the Esri Support App