VS2008,System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception fro...

本文解决了一个在VS2008中编译正常的程序在发布后出现System.Runtime.InteropServices.COMException的问题,错误代码为0x800401F3 (CO_E_CLASSSTRING),通过在app.config中添加jitDebugging配置解决了该问题。

在VS2008环境中编译调试运行不报错,但在发布的exe文件运行就报错

System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)),不得其解。

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

 

************** Exception Text **************

System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))

   at OPCAutomation.OPCServerClass.Connect(String ProgID, Object Node)

   at PlantAdminForPierburg.MainForm.ConnectToOPC(String OPCServerName, String OPCServerNode) in C:\Users\user\Desktop\IPCForPIERBURGSUV2018\PlantAdminForPIERBURG\MainForm.vb:line 1908

   at PlantAdminForPierburg.MainForm.MainForm_Load(Object sender, EventArgs e) in C:\Users\user\Desktop\IPCForPIERBURGSUV2018\PlantAdminForPIERBURG\MainForm.vb:line 64

   at System.EventHandler.Invoke(Object sender, EventArgs e)

   at System.Windows.Forms.Form.OnLoad(EventArgs e)

   at System.Windows.Forms.Form.OnCreateControl()

   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

   at System.Windows.Forms.Control.CreateControl()

   at System.Windows.Forms.Control.WmShowWindow(Message& m)

   at System.Windows.Forms.Control.WndProc(Message& m)

   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

   at System.Windows.Forms.ContainerControl.WndProc(Message& m)

   at System.Windows.Forms.Form.WmShowWindow(Message& m)

   at System.Windows.Forms.Form.WndProc(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

 

************** Loaded Assemblies **************

mscorlib

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8784 (QFE.050727-8700)

    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

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

PlantAdminForPierburg

    Assembly Version: 1.0.0.0

    Win32 Version: 1.0.0.0

    CodeBase: file:///C:/Users/user/Desktop/IPCForPIERBURGSUV2018/PlantAdminForPIERBURG/bin/Release/PlantAdminForPierburg.exe

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

Microsoft.VisualBasic

    Assembly Version: 8.0.0.0

    Win32 Version: 8.0.50727.5483 (Win7SP1GDR.050727-5400)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll

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

System

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8770 (QFE.050727-8700)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

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

System.Windows.Forms

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.5491 (Win7SP1GDR.050727-5400)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

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

System.Drawing

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.5495 (Win7SP1GDR.050727-5400)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

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

System.Configuration

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

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

System.Xml

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8773 (QFE.050727-8700)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

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

System.Runtime.Remoting

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8771 (QFE.050727-8700)

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll

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

System.Data

    Assembly Version: 2.0.0.0

    Win32 Version: 2.0.50727.8762 (QFE.050727-8700)

    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll

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

Interop.OPCAutomation

    Assembly Version: 1.0.0.0

    Win32 Version: 1.0.0.0

    CodeBase: file:///C:/Users/user/Desktop/IPCForPIERBURGSUV2018/PlantAdminForPIERBURG/bin/Release/Interop.OPCAutomation.DLL

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

 

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

 

For example:

 

<configuration>

    <system.windows.forms jitDebugging="true" />

</configuration>

 

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the computer

rather than be handled by this dialog box.

 

如下图所示,在app.config里配置一行即可。

    <system.windows.forms jitDebugging="true" />

加完这个记录后就正常了。。。。

 

转载于:https://www.cnblogs.com/albertfg/p/9407421.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值