ArcEngine 9.3.1与64位操作系统 80040154

几天前有个项目,在本机开发完毕后,由于数据量过大,因此想要把程序迁移到服务器上进行测试,可谁晓得连着换了三台服务器,连续遭遇了如下错误,弄得一帮人是一头雾水。

错误信息:

  未处理 System.TypeInitializationException
  Message="“test.Program”的类型初始值设定项引发异常。"
  Source="test"
  TypeName="test.Program"
  StackTrace:
       在 test.Program.Main()
       在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Runtime.InteropServices.COMException
       Message="检索 COM 类工厂中 CLSID 为 {E01BE902-CC85-4B13-A828-02E789E0DDA9} 的组件时失败,原因是出现以下错误: 80040154。"

------------------------------------------------------------------------------------------------------------

一直以为是Engine的安装版本与机器上的其他ArcGIS产品的版本不符,可是最后折腾到了一台没有装ArcGIS产品的服务器上,问题依旧。VS调试发现,从程序的入口检查License文件开始便报如上错误。在确认ArcEngine的运行许可可用的前提下,究竟是什么问题导致的这种情况呢?最后,在ESRI的Supports中找到了相关信息,源网址为http://forums.esri.com/thread.asp?c=159&f=1707&t=219248&mc=6

解决方法:

The ArcObjects COM components can't be loaded by a 64-bit .Net app and the default compilation of a new project is for "Any CPU." Check the Build tab under the project properties and set the platform target to x86。

Right click on the top icon in the Solution Explorer and select the Properties entry in the context menu. In the Properties page, select the Compile tab to the left, then clock the Advanced Compile Options button. This will bring up the Advanced Compiler Settings dialog. The last entry in the dialog is the Target CPU combobox, which defaults to the value AnyCPU. Change that to x86 and click OK.

This will solve the problems that manifest as an InnerException when you try to launch the app:

error number: "-2147221164"
message: "Retrieving the COM class factory for component with CLSID {E01BE902-CC85-4B13-A828-02E789E0DDA9} failed due to the following error:

posted @ 2010-03-29 09:24  水木  阅读(2673)  评论(0编辑  收藏  举报