AnsweredAssumed Answered

The Product License has not been initialised

Question asked by Nadir_Hussain on Aug 20, 2019
Latest reply on Jul 20, 2020 by alangley_mbaker

Dear All,

From last two days i am stuck in this error.i have googled it.but could not succeed.i am trying to connect arcsde geodatabase using arcobjects.

license status function return true and when i try to open the workspace factory i face the error "The Product License has not been initialised".please help.

if (LicenseStatus())
{
Console.WriteLine("Ready with license.");
IPropertySet propertySet = new PropertySetClass();

propertySet.SetProperty("SERVER", "DESKTOP-FQEJI3R");
//propertySet.SetProperty("SERVERINSTANCE", "localhost");
propertySet.SetProperty("SERVERINSTANCE", "sde:sqlserver:DESKTOP-FQEJI3R");
propertySet.SetProperty("DATABASE", "Test"); // Only if it is needed
propertySet.SetProperty("AUTHENTICATION_MODE", "DBMS");
propertySet.SetProperty("USER", "*****");
propertySet.SetProperty("PASSWORD", "*****");
//propertySet.SetProperty("DBCLIENT", "SQLServer");
propertySet.SetProperty("VERSION", "sde.Default");
// Create an SDE workspace factory and open the workspace.
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
IWorkspace workspace = workspaceFactory.Open(propertySet, 0); error Line
//CreateMathFunctionRasterDataset();
aoInit.Shutdown();
}
}
catch (Exception exc)
{
aoInitialize.Shutdown();
// If it fails at this point, shutdown the test and ignore any subsequent errors.
Console.WriteLine(exc.Message);
}

 

 

 

public bool LicenseStatus()
{
//This sample is designed to perform license initialization on a system
//that may have access to a floating license. An ArcEditor license will be used.

aoInitialize = new AoInitializeClass();

//Check the productCode.
esriLicenseStatus licenseStatus = aoInitialize.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);
if (licenseStatus == esriLicenseStatus.esriLicenseAvailable)
{
//Initialize the license.
licenseStatus = aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);
}

//Take a look at the licenseStatus to see if it failed.
if (licenseStatus == esriLicenseStatus.esriLicenseNotLicensed)
{
//Not licensed.
MessageBox.Show("You are not licensed to run this product");
return false;
}
else if (licenseStatus == esriLicenseStatus.esriLicenseUnavailable)
{
//The licenses needed are currently in use.
MessageBox.Show("There are insufficient licenses to run");
return false;
}
else if (licenseStatus == esriLicenseStatus.esriLicenseFailure)
{
//The licenses unexpectedly failed.
MessageBox.Show(
"Unexpected license failure please contact your administrator");
return false;
}
else if (licenseStatus == esriLicenseStatus.esriLicenseAlreadyInitialized)
{
//Already initialized (initialization can only occur once).
MessageBox.Show(
"Your license has already been initialized; please check your implementation.");
return false;
}
else if (licenseStatus == esriLicenseStatus.esriLicenseCheckedOut)
{
//Everything was checked out successfully.
MessageBox.Show("Licenses checked out successfully");
return true;
}

return false;

}

Attachments

Outcomes