【发布时间】:2013-08-25 23:53:27
【问题描述】:
我正在使用 ASP 和 VBScript 编写应用程序。我只能找到一个为 .Net 应用程序编写的库。因此,我尝试创建一个类库包装器并使用 VB.Net(Microsoft Visual Basic 2010 Express)将其编译为 DLL。
DLL 在我自己的桌面上工作(Windows 7),但在服务器(Server 2000)中失败。
错误信息是“系统找不到指定的文件”
服务器配置
操作系统:Microsoft Windows 2000 Server (SP4)
已安装.Net 框架:v2.0.50727
我在测试项目中编写的代码只是一个什么都不做的类。
Imports System.IO
Imports System
<ComClass(Object1.ClassId, Object1.InterfaceId, Object1.EventsId)> _
Public Class Object1
#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 = "f5dcfb08-7a83-4501-bd89-03e38cad819c"
Public Const InterfaceId As String = "8a313e0b-60e5-4ff4-8a7d-e7b1582eec71"
Public Const EventsId As String = "fe55f7d8-691f-4c76-968a-37019fa9bb53"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Sub Hello()
'...
End Sub
End Class
我做了什么:
在编译选项中选择“.NET Framework 2.0”
在我自己的桌面上编译
将 Bin\Release 中的所有文件直接复制到服务器上的文件夹中。
使用 Regasm.exe 在服务器上成功注册 DLL
但不能使用 VB6 或 VBScript 创建 Object1。
这是我在 VBScript 中使用的脚本:
Option Explicit
Dim TestObject
Set TestObject = CreateObject("TestComObject.Object1")
任何帮助将不胜感激!
亚历克斯
【问题讨论】:
-
在服务器上下载 DependencyWalker 并在您的包装 DLL 上运行它。完全有可能无法解决其中一个依赖项。不幸的是,正如您所发现的那样,Windows 在向您提供有关缺失内容的具体细节方面很糟糕。
标签: vb.net com asp-classic vbscript vb6