我需要为我的经典 asp 创建一个 com 对象,因为我可以创建一个 .net 程序集并让它与 com“互操作”,所以我继续创建一个这样的 .net 程序集:-
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Web;
namespace LMS
{
[ComVisible(true)]
public class Calc
{
public int Add(int val1, int val2, out string[] outputz)
{
int total = val1 + val2;
outputz = new string[5];
outputz[1] = "test2";
outputz[2] = "test3";
outputz[3] = "test4";
outputz[4] = "test5";
return total;
}
}
}
接下来我做了通常的构建,运行:gacutil & RegAsm
在我的经典asp页面中,我有这个:-
Dim params
dim objPassport3
set objPassport3 = Server.CreateObject("LMS.Calc")
comTest2 = objPassport3.Add(1,1,params)
我得到错误:
错误类型:Microsoft VBScript 运行时 (0x800A0005) 无效的过程调用或参数:“添加”/eduservice/test.asp,第 25 行
但是,如果我修改程序集不使用数组,这一切都可以正常工作,我什至可以将普通字符串或 int 发送到程序集和从程序集发送到经典 asp。我读了很多东西,但我得到了同样的错误,
以前有人尝试过并且成功了,请分享您的解决方案
谢谢