简体   繁体   English

获取“ Activex组件无法创建对象”

[英]Getting “Activex Component Cant Create Object”

I am trying to call C# function from VB Script code, I am getting "Activex Component cant create object" error. 我试图从VB脚本代码调用C#函数,但出现“ Activex组件无法创建对象”错误。

I have done the following. 我已经做了以下工作。

  1. Created class library with ProgID, and Comvisible True and strong named 创建带有ProgID的类库,并为Comvisible True和Strong命名
  2. Registered the dll using RegAsm.exe /codebase dllpath ( Dll registered successfully, I am able to see that in Registry) 使用RegAsm.exe / codebase dllpath注册了dll(Dll已成功注册,我能够在注册表中看到它)
  3. Creating object using VB Script code and calling C# function as below. 使用VB脚本代码创建对象并按如下所示调用C#函数。
Option Explicit
Dim testwfhandler
Set testwfhandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
If Not testwfhandler Is Nothing Then
    Call testwfhandler.test()
End If
Set testwfhandler= Nothing

Am executing this VB Script from third party application (Tridion workflow) installed in my server. 我正在从服务器上安装的第三方应用程序(Tridion工作流程)执行此VB脚本。

Don't know why am getting the above error,when i execute the same code from the server directly, it works fine. 不知道为什么会出现上述错误,当我直接从服务器执行相同的代码时,它工作正常。

test() this function will just create one log file and add some text inside that. test()此函数将只创建一个日志文件并在其中添加一些文本。

The answer is already provided through the comments but I figured it makes sense to suppy a real answer so that others can easily find it back. 答案已经通过评论提供了,但我认为提供一个真正的答案是有意义的,以便其他人可以轻松找到它。

Depending on how your VBScript is loaded/executed you should register your DLL using the 32-bit or 64-bit version of RegAsm.exe. 根据VBScript的加载/执行方式,应使用32位或64位版本的RegAsm.exe注册DLL。

On a 64-bit OS, you should find the 32-bit version of regasm in, C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\RegAsm.exe 在64位OS上,您应该在C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\RegAsm.exe找到32位版本的regasm。

and 64-bit version of regasm should be in, C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\RegAsm.exe 并且应该在64位版本的regasm, C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\RegAsm.exe

If you want to run the VBScript yourself in 32-bit mode on a 64-bit machine see How do I run a VBScript in 32-bit mode on a 64-bit machine? 如果要自己在64位计算机上以32位模式运行VBScript,请参见如何在64位计算机上以32位模式运行VBScript?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM