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;
}
I was running my script without signing into arcgis pro/online. the error went away after i signed in.
Hello. We have tasks on Task scheduler that run Python 3 scripts. I have scripts that had been running fine for weeks just recently not run at all with this
RuntimeError: The Product License has not been initialized.
I saw your reply, logged into ArcGIS Pro and it is now working. So I guess we have to log in periodically for our scheduled tasks to run? Kind of defeats the purpose of automation. At least they are running again and I'm glad I saw your reply.