[英]Need to call a .Net Class library dll from a Classic ASP Page
我需要從vbscript應用程序調用.Net類庫
我已經編寫了C#類庫並創建了COM DLL組件和類型庫文件
我已經使用以下方法在本地計算機上成功注冊了dll和tlb:
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注冊表中看到它們
現在問題是在asp頁面中訪問它:
<%@ 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>
當我運行此文件時,出現以下錯誤
該頁無法顯示
我收到一個錯誤
錯誤類型:
服務器對象,ASP 0177(0x80131522)
80131522
/testdll.asp,第25行
Set cls = Server.CreateObject(“ Sample.SqlJobs”)// SqlJobs是類的名稱
這將是第25行
未創建服務器實例
誰能幫助我找出問題所在,並向我提出解決此問題的可行方法?
如果您的程序集未安裝在GAC中,則應該在/codebase
命令行開關中使用regasm
。
“ ...代碼庫條目指定了未安裝在全局程序集緩存中的程序集的文件路徑...”-有關更多信息,請查看此鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.