在vs2022 下,用.net 8 开发API接口,在连接SDE 数据库时,提示:产品许可证尚未初始化 。
采用的是破解版的 arcgis desktop 10.8.2 相关dll。 也对授权验证都进行了测试,代码均返回true,但 open 时 ,依然提示 :The Product License has not been initialized
代码如下:
```c#
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
IAoInitialize m_aoinitialize = new AoInitializeClass();
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeStandard);
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeBasic);
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer);
m_aoinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);
var factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
var workspaceFactory = (SdeWorkspaceFactory)Activator.CreateInstance(factoryType);
IPropertySet propertySet = new PropertySetClass();
string arc_server = "192.168.8.160";
string arc_instance = "sde: oracle11g: 127.0.0.1/MYDB";
string arc_database = "MYDB";
string arc_user = "sde";
string arc_pwd = "sde";
string arc_version = "sde.DEFAULT";
propertySet.SetProperty("SERVER", arc_server);
propertySet.SetProperty("Instance", arc_instance);
propertySet.SetProperty("Database", arc_database);
propertySet.SetProperty("User", arc_user);
propertySet.SetProperty("Password", arc_pwd);
propertySet.SetProperty("Version", arc_version);
IWorkspace workspace = workspaceFactory.Open(propertySet, 0);//<——————这里报错