Select to view content in your preferred language

Licensing failing on client computer

3270
2
06-21-2012 04:14 PM
MichaelEvans
Deactivated User
Hi,

We are having a licensing issue. On my dev comuter, the code works fine. On the client's computer, it fails to obtain a license.

We both have the same software installed (ArcGis 10.0) and both are Windows 7 64-bit. We have tried both single user and floating licenses without luck.

We have run out of things to try.

Any help would be really appreciated.

Cheers,

Michael

Our simple test app is:


#include "stdafx.h"

#define ARCGIS_VERSION 10.0

#include <iostream>
#include <ArcSDK.h>


bool InitAttemptWithoutExtension(esriLicenseProductCode product)
{
  IAoInitializePtr ipInit(CLSID_AoInitialize);
  HRESULT hr =ipInit->InitializedProduct(&product);

  esriLicenseStatus status = esriLicenseFailure;
   hr = ipInit->Initialize(product, &status);
  return (status == esriLicenseCheckedOut);
}


int _tmain(int argc, _TCHAR* argv[])
{
printf("License test has started.\n");

// ::AoInitialize(NULL);
CoInitialize(NULL);
ESRI_SET_VERSION(esriArcGISEngine,ARCGIS_VERSION)

//ESRI_SET_VERSION(esriArcGISEngine,ARCGIS_VERSION);
IAoInitializePtr ipInit(CLSID_AoInitialize);

// ShutdownApp();

esriLicenseExtensionCode license = (esriLicenseExtensionCode)0;
if (license == 0)
{
// Try to init as engine, then engineGeoDB, then ArcView,
//    then ArcEditor, then ArcInfo
if (!InitAttemptWithoutExtension(esriLicenseProductCodeEngine))
  if (!InitAttemptWithoutExtension(esriLicenseProductCode::esriLicenseProductCodeEngineGeoDB))
   if (!InitAttemptWithoutExtension(esriLicenseProductCodeArcView))
   if (!InitAttemptWithoutExtension(esriLicenseProductCodeArcEditor))
    if (!InitAttemptWithoutExtension(esriLicenseProductCodeArcInfo))
    {
     printf("License test has failed.\n");
     while(1);
     return 0;
    }
}

printf("License test is successful.\n");

while(1);
return 0;
}
0 Kudos
2 Replies
ChaoWang
Esri Contributor
Hello,

Starting from 10, stand-alone ArcGIS applications must locate an appropriate ArcGIS product installation before any ArcObjects code (including license initialization) is called. Details please refer to the link below:

ArcObjects runtime binding for VC++ developers
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/ArcObjects_runtime_bind...

After adding the runtime binding to your code, you should be good to go.

Regards,
Chelsea
0 Kudos
MichaelEvans
Deactivated User
Thanks for the reply.

The SET_VERSION macro calls LoadVersion but fails at the client.

We have solved the problem but enumerating licenses using GetVersions and then explicitly calling one of the returned licenses.

Why this works is a complete mystery (since the returned license is the same as what was passed through anyway)?
0 Kudos