Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.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
Com VB6在Windows Server 2008中调用.net程序集时出现运行时429错误_Com_Vb6_Com Interop - Fatal编程技术网

Com VB6在Windows Server 2008中调用.net程序集时出现运行时429错误

Com VB6在Windows Server 2008中调用.net程序集时出现运行时429错误,com,vb6,com-interop,Com,Vb6,Com Interop,我从链接中尝试了这个简单的应用程序 .net代码 <ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _ Public Class ComClass1 #Region "COM GUIDs" ' These GUIDs provide the COM identity for this class ' and its COM in

我从链接中尝试了这个简单的应用程序

.net代码

    <ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
    Public Class ComClass1

    #Region "COM GUIDs"
        ' These  GUIDs provide the COM identity for this class 
        ' and its COM interfaces. If you change them, existing 
        ' clients will no longer be able to access the class.
        Public Const ClassId As String = "6DB79AF2-F661-44AC-8458-62B06BFDD9E4"
        Public Const InterfaceId As String = "EDED909C-9271-4670-BA32-109AE917B1D7"
        Public Const EventsId As String = "17C731B8-CE61-4B5F-B114-10F3E46153AC"
    #End Region

        ' A creatable COM class must have a Public Sub New() 
        ' without parameters. Otherwise, the class will not be 
        ' registered in the COM registry and cannot be created 
        ' through CreateObject.
        Public Sub New()
            MyBase.New()
        End Sub

Public Function myFunction() As Integer
      Return 100
   End Function

    End Class
它使用.NET4.0、VS2010和VB6在我的开发机器上运行。当我将文件复制到Windows Server 2008 R2计算机上,并使用Regasm AssemblyName.dll/tlb:FileName.tlb/codebase格式注册程序集,并对程序集进行强签名时,出现错误429无法创建ActiveX组件。我查了一下注册表,发现里面有classid。我错过了什么? 谢谢


此外,我还有一个旧版vb6应用程序,它使用RDS(远程数据服务)在另一台服务器上使用Com+创建对象,但我只想将其更改为在与vb6 exe相同的服务器上运行.Net dll。有没有办法从另一台客户端PC在服务器上运行exe而不注册.Net dll(tlb),或者我需要创建setup.exe来打包所有内容?我尝试在我的虚拟XPMode上运行相同的exe,但即使在创建安装应用程序时,我也会遇到相同的错误。它只在我的开发机器上工作。

使用正确版本的Regasm.exe,即Framework子目录中的版本,而不是Framework64子目录中的版本。如果仍然有问题,请使用SysInternal的ProcMon实用程序。您是对的!我猜我使用了错误的框架文件夹。我只是想了想,在看到你的答案之前就试过了。我打算写一个关于它的答案。尽管我创建了一个安装包,认为它可以正确注册dll,但我的XP虚拟机还是出现了相同的错误。因此,我用regasm.exe创建了一个注册表文件,并将其导入XP上的注册表中,它也可以正常工作。因此,看起来我必须在所有客户端PC上导入注册表设置。在不注册文件的情况下,我唯一能想到的另一种方法是使用DCOM。你的最后一段最好作为自己的问题。
Dim myObject As TestProj.COMClass1
Set myObject = New TestProj.COMClass1
MsgBox myObject.myFunction