需要从传统的ASP页面调用.NET类库DLL [英] Need to call a .Net Class library dll from a Classic ASP Page

查看:477
本文介绍了需要从传统的ASP页面调用.NET类库DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从一个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

这篇关于需要从传统的ASP页面调用.NET类库DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆