Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 执行一个c程序时发生异常_.net_Visual Studio_Com Interop - Fatal编程技术网

.net 执行一个c程序时发生异常

.net 执行一个c程序时发生异常,.net,visual-studio,com-interop,.net,Visual Studio,Com Interop,我有一个程序是.net。当我执行该程序时,我得到了这个异常。该程序应该与财政打印机通信 正在检索具有CLSID的组件的COM类工厂 {741F11B-0D59-4F59-A775-3E1B13721638}由于以下原因失败 错误:80040154类未注册HRESULT异常: 0x80040154 REGDB_E_CLASSNOTREG 输出: Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving

我有一个程序是.net。当我执行该程序时,我得到了这个异常。该程序应该与财政打印机通信

正在检索具有CLSID的组件的COM类工厂 {741F11B-0D59-4F59-A775-3E1B13721638}由于以下原因失败 错误:80040154类未注册HRESULT异常: 0x80040154 REGDB_E_CLASSNOTREG

输出:

 Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the
 COM class factory for component with CLSID {741F1E1B-0D59-4F59-A775-3E1B1372163
8} failed due to the following error: 80040154 Class not registered (Exception f
rom HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
 at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOn
 ly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Bo
  olean& bNeedSecurityCheck)
  at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChec
  kThis, Boolean fillCache)
  at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean s
 kipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
  at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at System.Activator.CreateInstance(Type type)
 at IncortexLibrary.Class1.PrintBon() in C:\Documents and Settings\woodley-who
 lesalers\My Documents\bst project\Projects\IncortexLibrary\IncortexLibrary\Class
 1.cs:line 29
    at ConsoleApp.Program.Main(String[] args) in C:\Documents and Settings\woodle
 y-wholesalers\My Documents\bst project\Projects\ConsoleApp\ConsoleApp\Program.cs
 :line 15

这让人头疼。我已经在system32中注册了文件.dll文件,但它仍然给我带来问题。这是否意味着我以错误的方式初始化程序。打印机显示为空。请帮助,因为我尝试浏览web,但没有得到解决方案,这通常是由于设置了权限问题注册表中的完全控制


我相信所有例外情况都发生在执行过程中:PExact duplicate@the_ajp是的,它是在执行过程中发生的。您知道它为什么会这样运行吗?“/”应用程序中出现服务器错误。链接处于脱机状态
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using IncortexLibrary;

 class Program
 {
    static void Main(string[] args)
    {
        Class1 printer = new Class1();
        printer.PrintBon();
    }
 }
 Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the
 COM class factory for component with CLSID {741F1E1B-0D59-4F59-A775-3E1B1372163
8} failed due to the following error: 80040154 Class not registered (Exception f
rom HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
 at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOn
 ly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Bo
  olean& bNeedSecurityCheck)
  at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChec
  kThis, Boolean fillCache)
  at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean s
 kipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
  at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at System.Activator.CreateInstance(Type type)
 at IncortexLibrary.Class1.PrintBon() in C:\Documents and Settings\woodley-who
 lesalers\My Documents\bst project\Projects\IncortexLibrary\IncortexLibrary\Class
 1.cs:line 29
    at ConsoleApp.Program.Main(String[] args) in C:\Documents and Settings\woodle
 y-wholesalers\My Documents\bst project\Projects\ConsoleApp\ConsoleApp\Program.cs
 :line 15