System.Runtime.InteropServices.COMException The Product License has not been initialized. ESRI GeoDatabase
2009-11-18 10:52
1486 查看
//授权信息加载
ESRI.ArcGIS.esriSystem.IAoInitialize m_AoInitialize = new ESRI.ArcGIS.esriSystem.AoInitialize();
m_AoInitialize.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo);
// Create and populate the property set
//ESRI.ArcGIS.esriSystem.IPropertySet propertySet = serverContext.CreateObject("esriSystem.PropertySet") as ESRI.ArcGIS.esriSystem.IPropertySet;
ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
propertySet.SetProperty("SERVER", server);
propertySet.SetProperty("INSTANCE", instance);
propertySet.SetProperty("DATABASE", database);
propertySet.SetProperty("USER", user);
propertySet.SetProperty("PASSWORD", password);
propertySet.SetProperty("VERSION", version);
//实例化为SDE工作空间仓库
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory;
workspaceFactory = (ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
//workspaceFactory = (ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)serverContext.CreateObject("esriDataSourcesGDB.SdeWorkspaceFactory")
// as IWorkspaceFactory2;
IWorkspace pWorkspace;
try
{
pWorkspace = workspaceFactory.Open(propertySet, 0);
}
catch
{
pWorkspace = null;
}
return pWorkspace;
=========================================================
2009.11.19 在另一机器上测试时,报错:
服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT))
==========================================================
后来把下面这句注释了
//IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)serverContext.CreateObject("esriDataSourcesFile.CadWorkspaceFactory");
同时改为下面的形式
//Create a WorkspaceName object
IWorkspaceName pWorkspaceName = new WorkspaceNameClass();
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory";
pWorkspaceName.PathName = path;
IWorkspaceFactory workspaceFactory = pWorkspaceName.WorkspaceFactory as IWorkspaceFactory;
感觉问题还是AE下开发serverContext.CreateObject和new的问题。
ESRI.ArcGIS.esriSystem.IAoInitialize m_AoInitialize = new ESRI.ArcGIS.esriSystem.AoInitialize();
m_AoInitialize.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo);
// Create and populate the property set
//ESRI.ArcGIS.esriSystem.IPropertySet propertySet = serverContext.CreateObject("esriSystem.PropertySet") as ESRI.ArcGIS.esriSystem.IPropertySet;
ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
propertySet.SetProperty("SERVER", server);
propertySet.SetProperty("INSTANCE", instance);
propertySet.SetProperty("DATABASE", database);
propertySet.SetProperty("USER", user);
propertySet.SetProperty("PASSWORD", password);
propertySet.SetProperty("VERSION", version);
//实例化为SDE工作空间仓库
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory;
workspaceFactory = (ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
//workspaceFactory = (ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)serverContext.CreateObject("esriDataSourcesGDB.SdeWorkspaceFactory")
// as IWorkspaceFactory2;
IWorkspace pWorkspace;
try
{
pWorkspace = workspaceFactory.Open(propertySet, 0);
}
catch
{
pWorkspace = null;
}
return pWorkspace;
=========================================================
2009.11.19 在另一机器上测试时,报错:
服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT))
==========================================================
后来把下面这句注释了
//IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)serverContext.CreateObject("esriDataSourcesFile.CadWorkspaceFactory");
同时改为下面的形式
//Create a WorkspaceName object
IWorkspaceName pWorkspaceName = new WorkspaceNameClass();
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory";
pWorkspaceName.PathName = path;
IWorkspaceFactory workspaceFactory = pWorkspaceName.WorkspaceFactory as IWorkspaceFactory;
感觉问题还是AE下开发serverContext.CreateObject和new的问题。
相关文章推荐
- WIN7 C# System.Runtime.InteropServices.COMException VLC HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)
- The Product License has not been initialized
- System.Runtime.InteropServices.COMException(0x8004020F): The server rejected one or more recipient addresses.
- System.Runtime.Remoting.RemotingException: has been disconnected or does not exist at the server
- System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM class factory for component with CLSID
- “System.Runtime.InteropServices.COMException”类型的第一次机会异常在 ESRI.ArcGIS.Version.dll 中发生
- The Product License has not been initialized.
- System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM class factory for component with CLSID
- WIN7 C# System.Runtime.InteropServices.COMException VLC HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)
- System.Runtime.InteropServices.COMException: Unknown error (0x80005000) on win7 box
- Visual Studio 2008 – ASP.NET “System.Runtime.InteropServices.COMException”
- System.Runtime.InteropServices.COMException: 检索 COM 类工厂中 CLSID 为 {0002E510-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80040154
- 解决System.Runtime.Interopservices.COMException问题
- This application has not been initialized with an ESRI license and will not function correctly 解决办法
- Asp.Net操作Word内容“System.Runtime.InteropServices.COMException: 命令失败”的解决方法
- c#程序在部分电脑运行异常解决方法(System.Runtime.InteropServices.COMException (0x80070422): 无法启动服务)
- C#读写Word文档异常处理解析System.Runtime.InteropServices.COMException
- Visual Studio 2008项目System.Runtime.InteropServices.COMException解决方法
- System.Runtime.InteropServices.COMException: 内存不足,请现在保存文档。 IIS 7
- Warning:This application has not been initialized with an ESRI license and ...