我需要从一个VBScript的应用程序调用.NET类库 我已经写了一个C#类库并创建了一个COM DLL组件和一个类型库文件 我已经使用成功注册的DLL和TLB我的本地计算机上
I need to call a .Net Class Library from a vbscript application I have written a C# class library and created a COM DLL component and a type library file I have successfully registered the dll and tlb on my local computer using
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe
"C:\user\Visual Studio 2008\Projects\[Sample]\[Sample]\bin\Debug\[Sample].dll"
/tlb "C:\user\Visual Studio 2008\Projects\[Sample]\[Sample]\bin\Debug\[Sample].tlb"
DLL和类型库文件被成功注册 我可以看到他们在Windows注册表中
The dll and the type library file are registered successfully I can see them in the windows registry
现在的问题是访问它在ASP页:
Now the issue is accessing it in an asp page:
<%@ Language=VBScript %>
<html>
<body>
<%
dim cls
dim myDevelopmentDBConn
Set myDevelopmentDBConn = Server.CreateObject("ADODB.Connection")
With myDevelopmentDBConn
.Provider = "SQLNCLI"
.ConnectionString = "user ID=abc;password=abc;Initial Catalog=TestLdb;Data
Source=sqlservername"
.ConnectionTimeout = 600
.CommandTimeout = 600
.Open
End With
Response.Write myDevelopmentDBConn
Set myDevelopmentDBConn =nothing
Set cls = Server.CreateObject("Sample.SqlJobs") 'SqlJobs is the name of the class
Response.Write cls
'Response.Write "<b>" & cls.UpdateSqlJob("Test1","sqlservername", "abc", "abc" ) & "</b>"
'Test1=sqlserverjob name
'abc-username
'abc-password
Set cls =nothing
%>
</body>
</html>
当我运行这个文件,我得到了以下错误
When I run this file I got the following error
该页面无法显示。
我得到一个错误
错误类型: 服务器对象,ASP 0177(0x80131522) 80131522 /testdll.asp,线25 设置CLS =的Server.CreateObject(Sample.SqlJobs)// SqlJobs是类名 这将是线25 在没有得到创建服务器实例
Error Type: Server object, ASP 0177 (0x80131522) 80131522 /testdll.asp, line 25 Set cls = Server.CreateObject("Sample.SqlJobs") //SqlJobs is the name of the class This will be the line 25 The server Instance is not getting created
任何人都可以请帮我找出我要去的地方错了,给我建议解决这个问题的可能途径?
Can anyone please help me figure out where I am going wrong and suggest me possible ways of fixing this issue?
您应该使用 / codeBase的
命令行开关 regasm
如果你的程序集未安装到GAC。
You should be using the /codebase
command line switch with regasm
if your assembly is not installed into the GAC.
...的codeBase的条目为未安装在全局程序集缓存中的程序集的文件路径... - 看看的更多信息链接
"...The Codebase entry specifies the file path for an assembly that is not installed in the global assembly cache..." - have a look at this link for more info