ArcEngine 无法打开shape(打开工作空间出现 COM Exception 0x80040228错误)

错误描述:编译时没有问题,运行后无法加载shape图层;

运行到该代码:

            //创建工作空间
            IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();
            IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(fileFolder, 0);

出现:COM Exception 0x80040228错误

添加AxLicense控件也无法解决。

最终使用下述方法解决问题:

When we migrate our code from ArcGis 9.3 to ArcGis 10 then this type of error occurs. 

1.First we add Reference ESRI.ArcGis.ADF.Local

2.Add Reference ESRI.ArcGis.Version

3.Add Line 

“ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop); ”

prior to call any arcgis object.

4.In all ArcGis Reference property "Specific Version" set to false.

5.Now Go to Project menu of visual studio and there are one option "Add ArcGis License Checking" and Add this file to your project.

参考:

http://www.bubuko.com/infodetail-478122.html


猜你喜欢

转载自blog.csdn.net/hellfire2007/article/details/79434270
今日推荐