asp.net - 在客户端计算机上注册 .NET COM DLL 文件

标签 asp.net dll asp-classic com com+

我需要以下方面的意见:

我使用 .NET 创建了一个 DLL 文件。此 DLL 文件旨在用于 ASP Classic和 ASP.NET 应用程序。我创建了一个安装和部署包,并将解决方案的输出添加到 GAC文件夹。之后,在 ASP Classic 中创建实例就不起作用了。我不确定它是否可以从 GAC 文件夹加载。

或者,我通过添加从 ServiceComponent 继承和其他必要的更改来将此 .dll 转换为 COM,但在客户端上注册为 COM 时,它会引发错误:

one or more files do not contain components or type libraries

我错过了什么?我该怎么做才能使 DLL 文件可以被 ASP Classic 和 ASP.NET 使用?

最佳答案

步骤...

Visual studio: start a new class library
Properties > Application : make assembly COM-Visible
Properties > Build : Register for COM interop
Properties > Signing: Sign the assembly

然后构建项目。

以管理员身份启动 Visual Studio 命令提示符(在操作系统菜单中查找此命令提示符):

cd <path to your dll>
RegAsm /register <name of your dll>.dll /tlb:<name of your dll>.tlb
gacutil -i <name of your dll>.dll
IISreset (not a bad idea to reset after these stepts in your development environment because the dll gets cached)

这应该可以解决问题...

最后的建议...从头开始构建一个新项目(只是一个 Hello World)并将上述步骤融入您的 DNA 中。这是...它起作用的领域之一 - 不,它不起作用 - 现在它再次起作用发挥了重要作用;-)

关于asp.net - 在客户端计算机上注册 .NET COM DLL 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20878728/

相关文章:

android - 支持 native 移动应用程序中的 ASP.Net Forms 身份验证

asp.net - 登录尝试 5 次失败后阻止用户 IP?

.net - Mono 2.4、AutoHosting 和 MVC

audio - 如何在不安装ASIO4ALL的情况下使用 “asio4all.dll”?

由于 "using"另一个 DLL,C# DLL 程序集加载失败

asp-classic - 无效的过程调用或参数 : 'Mid'

html - 调整浏览器大小时,在 DataList 中垂直包装元素

python - PyWin32 和 Python 3.8.0

Javascript 从 vbscript 传递变量

iis - 在经典 ASP/Javascript 中将对象插入全局范围