Code Bye

ArcGIS Engine COM异常 HRESULT E_FAIL

我的项目中使用Gp做intersect,调试没问题,打包后运行interset却出现HRESULT E_FAIL,但打包后使用GP做buffer却没问题。请问这个该如何解决呢,arcengine 10.0
下面是自裁剪intersect类:

public static IFeatureLayer GetIntersectFeature(string pLayerPath, string OutPath, string Option)
  {
    //ILayer pLayer;
		Geoprocessor pGeoprocessor;
		IGeoProcessorResult pGeoProcessorResult;
		IGPUtilities pIGPUtilities;
		IFeatureClass pFeatureClass;
		IQueryFilter pQueryFilter;
    IFeatureLayer pFeatureLayer;

		ESRI.ArcGIS.AnalysisTools.Intersect intersect = new ESRI.ArcGIS.AnalysisTools.Intersect();
		intersect.in_features = pLayerPath;
		intersect.out_feature_class = OutPath;
		intersect.join_attributes = Option;
		//pFeatureLayer = GetIGPProcessLayer(intersect as IGPProcess);
		//return pFeatureLayer;

		pGeoprocessor = new Geoprocessor();
		ConnectGDBSQL pConnectGDBSQL = new ConnectGDBSQL();
		IWorkspace pWorkspace = pConnectGDBSQL.ConnectGDB();

		pGeoprocessor = new Geoprocessor();
		pGeoprocessor.SetEnvironmentValue("workspace", pWorkspace.PathName);
		pGeoprocessor.OverwriteOutput = true;
		pGeoProcessorResult = pGeoprocessor.Execute(intersect, null) as IGeoProcessorResult;

		pIGPUtilities = new GPUtilitiesClass();
		pIGPUtilities.DecodeFeatureLayer(pGeoProcessorResult.GetOutput(0), out pFeatureClass, out pQueryFilter);
		pFeatureLayer = new FeatureLayerClass();
		pFeatureLayer.FeatureClass = pFeatureClass;
		return pFeatureLayer;
  }

40分
main中初始化licence时,只初始化最高级别的,另外 HRESULT E_FAIL 还可能是调用GP时参数上的错误,比如intersect时不要输入要素的物理路径(path),改成输入featureclass就不会出错,实际上输入path时开发调试时不会出错,打包后就会报HRESULT E_FAIL了。 我的环境:arcgis engine 10.0

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明ArcGIS Engine COM异常 HRESULT E_FAIL