Windows Server 2008中VB6调用.net程序集中的运行时429错误

时间:2012-09-26 15:41:06

标签: com vb6 com-interop

我尝试了链接How to call a Visual Basic .NET or Visual Basic 2005 assembly from Visual Basic 6.0

中的简单应用

.net code

    <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

vb6代码

Dim myObject As TestProj.COMClass1
Set myObject = New TestProj.COMClass1
MsgBox myObject.myFunction

它可以在我的开发机器上使用.Net 4.0和VS 2010和VB6。当我将文件复制到Windows Server 2008 R2计算机并使用格式Regasm AssemblyName.dll / tlb:FileName.tlb / codebase注册程序集并且还强烈签署程序集时,我得到错误429无法创建ActiveX组件。我检查了注册表,然后在那里看到了classid。我错过了什么? 感谢

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

0 个答案:

没有答案