问题描述
环境vs2010+c#+Arcgis10.1代码如下:Geoprocessorgp=newGeoprocessor();gp.OverwriteOutput=true;gp.AddOutputsToMap=true;Eraseerase=newErase();erase.in_features=@"D:tempss.shp";erase.erase_features=@"D:tempsss.shp";erase.out_feature_class=@"D:tempq.shp";IGeoProcessorResultresult=(IGeoProcessorResult)gp.Execute(erase,null);调试报错:未处理System.Runtime.InteropServices.COMExceptionMessage=对COM组件的调用返回了错误HRESULTE_FAIL。Source=ESRI.ArcGIS.GeoprocessingErrorCode=-2147467259StackTrace:在ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(StringName,IVariantArrayipValues,ITrackCancelpTrackCancel)在ESRI.ArcGIS.Geoprocessor.Geoprocessor.ExecuteInner(IGPProcessprocess,ITrackCanceltrackCancel,IGeoProcessorigp,IVariantArrayiva)在ESRI.ArcGIS.Geoprocessor.Geoprocessor.Execute(IGPProcessprocess,ITrackCanceltrackCancel)在DesktopWindowsApplication1.Form1.图层属性ToolStripMenuItem_Click(Objectsender,EventArgse)位置D:VS_WorkspaceDesktopWindowsApplication1DesktopWindowsApplication1Form1.cs:行号78在System.Windows.Forms.ToolStripItem.RaiseEvent(Objectkey,EventArgse)在System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgse)在System.Windows.Forms.ToolStripItem.HandleClick(EventArgse)在System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgse)在System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgse,ToolStripItemEventTypemet)在System.Windows.Forms.ToolStripItem.FireEvent(EventArgse,ToolStripItemEventTypemet)在System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgsmea)在System.Windows.Forms.Control.WmMouseUp(Message&m,MouseButtonsbutton,Int32clicks)在System.Windows.Forms.Control.WndProc(Message&m)在System.Windows.Forms.ScrollableControl.WndProc(Message&m)在System.Windows.Forms.ToolStrip.WndProc(Message&m)在System.Windows.Forms.MenuStrip.WndProc(Message&m)在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&m)在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&m)在System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtrhWnd,Int32msg,IntPtrwparam,IntPtrlparam)在System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&msg)在System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtrdwComponentID,Int32reason,Int32pvLoopData)在System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32reason,ApplicationContextcontext)在System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32reason,ApplicationContextcontext)在System.Windows.Forms.Application.Run(FormmainForm)在DesktopWindowsApplication1.Program.Main()位置D:VS_WorkspaceDesktopWindowsApplication1DesktopWindowsApplication1Program.cs:行号18在System.AppDomain._nExecuteAssembly(RuntimeAssemblyassembly,String[]args)在System.AppDomain.ExecuteAssembly(StringassemblyFile,EvidenceassemblySecurity,String[]args)在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()在System.Threading.ThreadHelper.ThreadStart_Context(Objectstate)在System.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate,BooleanignoreSyncCtx)在System.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate)在System.Threading.ThreadHelper.ThreadStart()InnerException:试过网上找的方法:1.在控制面板--->管理工具--->服务中,开启DistributedTransactionCoordinator服务。 2.打开控制面板--->管理工具--->组件服务--->选择计算机--->我的电脑--->右击属性--->选择MSDTC--->选择安全配置勾选事务管理器通信中的允许出站、允许入站和不要求进行验证。重启后依然无效,求救各位大神!!!
解决方案
解决方案二:
借鉴
解决方案三:
非常感谢你的回答,你给的网站还是有很多东西可以借鉴学习的。这个问题已经解决http://blog.csdn.net/wanderinglove/article/details/25773681特别要注意授权问题
解决方案四:
解决方案五:
你是怎么处理的,楼主?