1 Reply Latest reply on Apr 2, 2014 9:42 AM by Dori Bearham

    AoInitializeClass.IsProductCodeAvailable takes over a minute

    Dori Bearham


      I created a dll that handles Process table updates for a Work Management interface. I created an ASP.net web api that the work management system will send an HTTP POST message containing work request data. The web api references the dll. The issue is when the code executes to get the ArcGIS license it takes over a minute. I'm running in ArcGIS 10 SP5 and Designer 10.0.2. License Manager is running on it's own server. Getting the Designer license doesn't take long at al. If I make the same calls in a console app it takes only a couple of seconds to get the ArcGIS license. I don't know what I'm missing. Any help is appreciated.

       

      Here's the call to GetArcGISLicense:

      _LicenseAdmin.GetArcGISLicense(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);

       

       

      public bool GetArcGISLicense(esriLicenseProductCode prodCode)

      {

                  //must first bind to to ArcGIS    --this is being done in the Application_Start in the calling project

          //RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);

                  RuntimeManager.Bind(ProductCode.EngineOrDesktop);

       

                  //Create a new AoInitialize object

      try

      {

                      _AoInitialize = new AoInitializeClass();

      }//The initialization object

      catch

      {

      iLog.Warn("Warning: Unable to initialize Arc Objects. License cannot be checked out.");

      return false;

      }

       

      if (_AoInitialize == null)

      {

      iLog.Warn("Warning: Unable to initialize Arc Objects. License cannot be checked out.");

      return false;

      }

       

      //Determine if the product is available

      esriLicenseStatus licenseStatus = (esriLicenseStatus) _AoInitialize.IsProductCodeAvailable(prodCode);

      if (licenseStatus == esriLicenseStatus.esriLicenseAvailable)

      {

      licenseStatus = (esriLicenseStatus) _AoInitialize.Initialize(prodCode);

      if (licenseStatus != esriLicenseStatus.esriLicenseCheckedOut)

      {

      iLog.Warn("Warning: The license checkout for " + prodCode.ToString() + " failed!");

      return false;

      }

      }

      else

      {

      iLog.Warn("Warning: The ArcGIS product " + prodCode.ToString() + " is unavailable!");

      return false;

      }

      return true;

      }