【问题标题】:System.Runtime.InteropServices.COMException | vb.netSystem.Runtime.InteropServices.COMException | VB.net
【发布时间】:2016-11-17 20:18:29
【问题描述】:

我知道这个问题已经回答了很多次,但我已经尝试了所有以前建议的解决方案。

1.) 目标 CPU 是 x86

2.) 我已经注册了 ocx 和 dll 文件

该应用程序在旧机器(所有操作系统)上运行良好,但在新图像上却不行。

这是日志:

框架版本:v4.0.30319 描述:进程被终止 由于未处理的异常。异常信息: System.Runtime.InteropServices.COMException 在 System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(System.Guid ByRef, System.Object, Int32, System.Guid ByRef) 在 System.Windows.Forms.AxHost.CreateWithLicense(System.String, System.Guid) 在 System.Windows.Forms.AxHost.CreateInstanceCore(System.Guid) 在 System.Windows.Forms.AxHost.CreateInstance() 在 System.Windows.Forms.AxHost.GetOcxCreate() 在 System.Windows.Forms.AxHost.TransitionUpTo(Int32) 在 System.Windows.Forms.AxHost.CreateHandle() 在 System.Windows.Forms.Control.CreateControl(Boolean) 在 System.Windows.Forms.Control.CreateControl(Boolean) 在 System.Windows.Forms.AxHost.EndInit() 在 Restaurant.frmMain.InitializeComponent() 在 Restaurant.frmMain..ctor()

异常信息:System.InvalidOperationException 在 Restaurant.My.MyProject+MyForms.Create__Instance__[System.__Canon, mscorlib,版本=4.0.0.0,文化=中性, PublicKeyToken=b77a5c561934e089] 在 Restaurant.frmMain.Main()

这是我注册文件的方式:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Caspol -q -machine -addgroup 1 -url file://C:/xyz/* FullTrust -name "V Drive"

regsvr32 c:\xyz\crystl32.ocx

regsvr32 c:\xyz\MSCOMCT2.OCX

regsvr32 c:\xyz\MSDATGRD.OCX

regsvr32 c:\xyz\cpeaut32.dll

regsvr32 c:\xyz\msstdfmt.dll

Crystal 报告系统上安装了 .NET 4 框架的运行时引擎(x86 和 x64)。

【问题讨论】:

    标签: vb.net com crystal-reports comexception


    【解决方案1】:

    我曾经遇到过这个问题。

    I ran Visual Studio as administrator. Also make sure you know which setting your platform is for the build: AnyCPU, x86, x64

    对于你来说它是 x86,所以尝试使用 AnyCPU!

    尝试调试问题 我阅读了 Microsoft 的一篇文章,其中说您可以通过以下方式调试发生此异常的位置:

    Debug > Exceptions... and use the Find option to locate System.Runtime.InteropServices.COMException. Tick the option to break when it's thrown and then debug your application.

    【讨论】:

    • 感谢@JT4U 的回复。该应用程序在我的开发机器上运行良好。部署到我们的其中一台测试服务器时,它无法正常工作。
    • 如果您觉得答案有用。请投票。所以下一个被卡住的成员可以使用这个问题。谢谢! @DeependraSingh
    • 很遗憾您的建议没有解决我的问题。我以前试过这个,但我的开发机器上从来没有出现任何错误。它仅在我部署代码时发生。
    • 您是否使用正确的构建平台部署代码?
    • 是的。我们一直在将相同的代码复制到用户机器上。复制后,我们注册 ocx 文件,它运行良好。最近我们开始在新机器上遇到这个问题。
    猜你喜欢
    • 1970-01-01
    • 2011-09-09
    • 2011-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-07
    • 1970-01-01
    • 2011-05-15
    相关资源
    最近更新 更多