exception while executing a program a c# program
我有一个 .net 程序。当我执行该程序时出现此异常。该程序应该与财务打印机通信。
Retrieving the COM class factory for component with CLSID
{741F1E1B-0D59-4F59-A775-3E1B13721638} failed due to the following
error: 80040154 Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG)).
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using FiscPrinter = FiscPrnSys.IFiscPrnIface; using System.Runtime.InteropServices; public class Class1 { public List<String> salesITems = new List<String>(); public String user; public String shop; public double total; public double subtotal; public String tax; public short data = (short) 8; public short parity = (short)0; public short stopbit = (short)1; public void PrintBon() |
这个类被另一个类调用,它是
1
2 3 4 5 6 7 8 9 10 11 12 13 14 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using IncortexLibrary; class Program |
输出:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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 文件,但它仍然给我带来了问题。这是否意味着我以错误的方式初始化程序。打印机显示为空。请帮助因为我试图浏览网络但没有得到解决方案
这通常是由于权限问题在注册表中设置完全控制
http://support.software602.com/kb/view.aspx?articleID=987
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/269734.html