最近要用到招行的支付接口
需要注册运行程序报错检索 COM 类工厂中 CLSID 为 {820280E0-8ADA-4582-A1D9-960A83CE8BB5} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。然后注册,出现一下错误模块“Interop.Interop.CMBCHINALib.dll”已加载,但找不到入口点 DllRegisterServer。请确保“Interop.MODI.dll”为有效的 DLL 或 OCX 文件,然后重试。求指教,谢谢各位。

解决方案 »

  1.   

    确定能这么注册?提示了不是com组件
      

  2.   

    你是win 7 吗
    可能是权限问题
    你要
    开始--所有程序--附件--命令行--右键“以管理员身份运行”进入cmd方式,然后再regsvr32 就可以了
      

  3.   


    还是提示下面的:
    模块“Interop.Interop.CMBCHINALib.dll”已加载,但找不到入口点 DllRegisterServer。请确保“Interop.MODI.dll”为有效的 DLL 或 OCX 文件,然后重试。
      

  4.   

    模块“Interop.Interop.CMBCHINALib.dll”已加载,但找不到入口点 DllRegisterServer。这不是提示了吗?
      

  5.   


    引用之后,

    检索 COM 类工厂中 CLSID 为 {820280E0-8ADA-4582-A1D9-960A83CE8BB5} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。

    这个错误
      

  6.   

    这个还真心不清楚,namespace CMBCHINALib
    {
        [TypeLibType(2)]
        [Guid("820280E0-8ADA-4582-A1D9-960A83CE8BB5")]
        [ClassInterface(0)]
        public class FirmClientClass : IFirmClient, FirmClient
        {
            public FirmClientClass();        [DispId(2)]
            public virtual short exCancelOrder(string pszCoNo, string pszBillNo, string pszRefNo);
            [DispId(3)]
            public virtual short exCheckInfoFromBank(string pszPublickeyFilePath, string pszMsg);
            [DispId(18)]
            public virtual short exCheckSignatureFromBank(string pszPublickeyFilePath, string pszData, string pszSignature);
            [DispId(17)]
            public virtual object exGenMerchantCode(string bKey, string bDate, string bBranchID, string bCono, string bBillno, string bAmount, string bMerchantPara, string bMerchantUrl, string bPayer, string bPayee, string bIP, string bGoodType, string bReserved);
            [DispId(1)]
            public virtual string exGetLastErr(short isNo);
            [DispId(15)]
            public virtual short exHasNextPage();
      

  7.   

    Interop.MODI.dll这个是什么?
    是不是也要注册?
      

  8.   

       COM最好用c++ 做。C# 垃圾的一比潦倒
      

  9.   

    注册表里   heky-classes-root / clsid/下看看是否有820280E0-8ADA-4582-A1D9-960A83CE8BB5 ,没有说明没有注册
      

  10.   

    如果没注册,需要通过regasm工具在及其上进行注册。
      

  11.   

    注册上了,clsid中有了。然后,需要加载吗?
      

  12.   

    需要根据clsid创建实例.... www.codeproject.com搜 com interop,找个例子看看。我的代码找不到了
      

  13.   

    页面所在项目右键--->属性--->生成里的目标平台改成Any CPU应该就没问题了!
      

  14.   

    你说的是你自己吧,除了会拖控件,你还会什么?我一直在用C#设计核心框架,编写服务,桌面应用则用WPF编写,手写代码排版。
      

  15.   

    调用端:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.Runtime.InteropServices.ComTypes;
    using System.Reflection;
    using System.ComponentModel;
    using System.Runtime.CompilerServices;namespace CTCSimulator
    {
        class Simulator
        {
            [STAThread]
            static void Main(string[] args1)
            {            System.Guid guidClass = new Guid("DB9935C1-19C5-4ed2-ADD2-9A57E19F53A7");
                System.Type t = Type.GetTypeFromCLSID(guidClass);
                object comObject = System.Activator.CreateInstance(t);            object reslut1 = t.InvokeMember("HelloWorld", BindingFlags.InvokeMethod, null, comObject, null);
                Console.WriteLine(reslut1.ToString());            ICSSimpleObjectEventsSinkHelper sink = new ICSSimpleObjectEventsSinkHelper();
                Int32 sinkCokie;
                IConnectionPointContainer cpc = comObject as IConnectionPointContainer;
                IConnectionPoint ppCP;
                Guid guidEvent = new Guid("014C067E-660D-4d20-9952-CD973CE50436");
                cpc.FindConnectionPoint(ref guidEvent, out ppCP);
                try
                {
                    ppCP.Advise(sink, out sinkCokie);
                }
                catch (Exception e) { }            object reslut2 = t.InvokeMember("HelloWorld", BindingFlags.InvokeMethod, null, comObject, null);
                Console.WriteLine(reslut2.ToString());
                t.InvokeMember("FloatProperty", BindingFlags.SetProperty, null, comObject, new object[] { 10.0 });
                float fProp = (float)t.InvokeMember(
                        "FloatProperty", BindingFlags.GetProperty, null,
                        comObject, null);
                Console.WriteLine("Now the property FloatProperty is:"+fProp.ToString());
                Console.ReadLine();
                
                Marshal.FinalReleaseComObject(comObject);
            }
        }    [ComVisible(true), InterfaceType(ComInterfaceType.InterfaceIsIDispatch), Guid("014C067E-660D-4d20-9952-CD973CE50436")]
        public interface ICSSimpleObjectEvents
        {
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x00000001)]
            void FloatPropertyChanging(string args);
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x00000002)]
            void CreatePJEvent(string msg);
        }
        [ClassInterface(ClassInterfaceType.None)]
        public sealed class ICSSimpleObjectEventsSinkHelper : ICSSimpleObjectEvents
        {
            public void FloatPropertyChanging(string args)
            {
                Console.WriteLine("Event handled by CSExeComServerClient:"+args);
                Console.WriteLine("");
            }
            public void CreatePJEvent(string msg)
            {
                Console.WriteLine("PJ created using msg:" + msg);
            }
        }
    }
      

  16.   

    服务端:#region Using directives
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.Runtime.InteropServices.ComTypes;
    using System.ComponentModel;
    using E30GEMServer;
    using E5MessageCenter;#endregion
    using System.Collections;namespace ComServer
    {
        [Guid(CSSimpleObject.InterfaceId), ComVisible(true)]
        public interface ICSSimpleObject 
        {
            float FloatProperty { get; set; }
            [DispId(0x10000001)]
            string HelloWorld();        void GetProcessThreadID(out uint processId, out uint threadId);
            
            [DispId(0x10000002)]
            void Dispose();               [DispId(0x10000005)]
            string[] GetStringArray();        [DispId(0x10000006)]
            AlarmINfo GetAlaramInof();        [DispId(0x10000007)]
            
            AlarmINfo[]  GetBody( );        [DispId(0x10000008)]
            [Description("asdfasdfasdf")]
            StepInfo[] Getinfo();    }    [ComVisible(true)]
        [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct AlarmINfo
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
            public string name;
            public int age;
            public float value;
            public double fval;
        }    [ComVisible(true)]
        [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct StepInfo
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
            public string name;
            public string[] valuelist;        public AlarmINfo alarm;
        }    [Guid(CSSimpleObject.EventsId), ComVisible(true)]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]//,TypeLibType((short)0x1010)
        public interface ICSSimpleObjectEvents
        {
            [DispId(0x00000001)]
            void FloatPropertyChanging(string args);        [DispId(0x00000002)]                
            void CreatePJEvent(string msg);    }
        [ClassInterface(ClassInterfaceType.None)]           // No ClassInterface
        [ComSourceInterfaces(typeof(ICSSimpleObjectEvents))]
        [Guid(CSSimpleObject.ClassId), ComVisible(true)]
        public class CSSimpleObject : ReferenceCountedObject, ICSSimpleObject, IObjectSafety, ICreatePJ
        {
            private const int INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001;
            private const int INTERFACESAFE_FOR_UNTRUSTED_DATA = 0x00000002;
            private const int S_OK = 0;        public CSSimpleObject()
            {
            }        public string[] GetStringArray()
            {
                string[] ret = new string[2];
                return ret;
            }        public AlarmINfo GetAlaramInof()
            {
                AlarmINfo a = new AlarmINfo();
                return a;
            }        public AlarmINfo[] GetBody()
            {
               
                AlarmINfo[] ret = new AlarmINfo[1];
                AlarmINfo a = new AlarmINfo();
                ret[0] = a;
                return ret;
            }        public StepInfo[] Getinfo()
            {
                StepInfo[] ret = new StepInfo[1];            return ret;
            }        internal const string ClassId =
                "DB9935C1-19C5-4ed2-ADD2-9A57E19F53A7";
            internal const string InterfaceId =
                "941D219B-7601-4375-B68A-61E23A4C8425";
            internal const string EventsId =
                "014C067E-660D-4d20-9952-CD973CE50436";        [EditorBrowsable(EditorBrowsableState.Never)]
            [ComRegisterFunction()]
            public static void Register(Type t)
            {
                try
                {
                    COMHelper.RegasmRegisterLocalServer(t);
                }
                catch (Exception ex)
                {
                }
            }        [EditorBrowsable(EditorBrowsableState.Never)]
            [ComUnregisterFunction()]
            public static void Unregister(Type t)
            {
                try
                {
                    COMHelper.RegasmUnregisterLocalServer(t);
                }
                catch (Exception ex)
                {
                }
            }
            private float fField = 0;        public float FloatProperty
            {
                get { return this.fField; }
                set
                {
                    fField = value;
                    Console.WriteLine("FloatProperty property is being udpated by '" + value.ToString() + "'");
                    string result = "Event Handler is not registed!";
                    if (null != FloatPropertyChanging)
                    {
                        if (E30Status.SV == "SV" && E30Status.CNNList.Contains("CNN2"))
                        {
                            Console.WriteLine("Event is being fired from Property Float changing!");
                            FloatPropertyChanging("In CNN2,Event Fired from Property Float changing!");
                        }
                        if (E30Status.SV == "SV" && E30Status.CNNList.Contains("CNN1"))
                        {
                            Console.WriteLine("Event is being fired from Property Float changing!");
                            FloatPropertyChanging("In CNN1, Event Fired from Property Float changing!");
                        }
                    }
                    
                }
            }        public string HelloWorld()
            {
                if (this.CreatePJEvent != null)
                {
                    string[] msg = new string[1];
                    msg[0] = "asd";
                    this.CreatePJEvent("asdf");
                }            if (null != FloatPropertyChanging)
                {
                    FloatPropertyChanging("Event Fired from HelloWorl Mehtod Calling!");
                }
                return null;
            }        public void CreatePJ(string msg)
            {
                if (null != CreatePJEvent)
                {
                    Console.ReadLine();
                }
            }        public void GetProcessThreadID(out uint processId, out uint threadId)
            {
                processId = NativeMethod.GetCurrentProcessId();            threadId = NativeMethod.GetCurrentThreadId();
            }
            [ComVisible(false)]
            public delegate void FloatPropertyChangingEventHandler(string args);
            [ComVisible(false)]
            public delegate void CreatePJEventHandler(string msg);        public event FloatPropertyChangingEventHandler FloatPropertyChanging;        
            public event CreatePJEventHandler CreatePJEvent;             public int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions)
            {
                pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
                pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
                return S_OK;   // return S_OK
            }        public int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions)
            {
                return S_OK;   // return S_OK
            }        public void Dispose()
            {
                Console.WriteLine("MyComComponent is now disposed");
            }
        }    internal class CSSimpleObjectClassFactory : IClassFactory
        {
            public int CreateInstance(
                IntPtr pUnkOuter, ref Guid riid, out IntPtr ppvObject)
            {
                ppvObject = IntPtr.Zero;            if (pUnkOuter != IntPtr.Zero)
                {
                    Marshal.ThrowExceptionForHR(COMNative.CLASS_E_NOAGGREGATION);
                }            if (riid == new Guid(CSSimpleObject.InterfaceId) ||
                    riid == new Guid(COMNative.GuidIUnknown))
                {
                    Console.WriteLine("Com server is calling factory to create com object.");
                    ppvObject = Marshal.GetComInterfaceForObject(
                        new CSSimpleObject(), typeof(ICSSimpleObject));                
                }
                else
                {
                    Marshal.ThrowExceptionForHR(COMNative.E_NOINTERFACE);
                }
                return 0;   // S_OK
            }        public int LockServer(bool fLock)
            {
                return 0;   // S_OK
            }
        }    [ComVisible(false)]
        public class ReferenceCountedObject
        {
            public ReferenceCountedObject()
            {
                ExeCOMServer.Instance.Lock();
            }        ~ReferenceCountedObject()
            {
                ExeCOMServer.Instance.Unlock();
            }
        }    [ComImport]
        [Guid("CB5BDC81-93C1-11CF-8F20-00805F2CD064")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        interface IObjectSafety
        {
            [PreserveSig]
            int GetInterfaceSafetyOptions(ref Guid riid, out int pdwSupportedOptions, out int pdwEnabledOptions);        [PreserveSig]
            int SetInterfaceSafetyOptions(ref Guid riid, int dwOptionSetMask, int dwEnabledOptions);
        }
    }