安装一个c#com dll供vbscript classic asp网站使用 [英] install a c# com dll for use by vbscript classic asp website

查看:148
本文介绍了安装一个c#com dll供vbscript classic asp网站使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有vb6 dll的经典ASP网站,一切都与世界一致,但现在我有一些额外的功能已经使用c#完成到COM DLL中。在开发环境中,这是工作,但现在我想把这个DLL移动到另一台机器上。



我的问题是什么是最好的方法? >

我已经看到了添加到GAC或需要一个强名称等答案。



发生什么事情好的老regsvr32?

解决方案

Regsvr32今天依然是有意义的,但你不能用.NET ,只有本机DLL。 .NET有一种注册COM类型的特殊方法,我们将会很快看到。



Regsvr32通过调用 DllRegisterServer 导出工作。 DllRegisterServer 使图书馆有机会注册COM类;类型库;接口等。这个导出不存在于.NET创建的.dll中,这是有意义的,因为默认情况下它们不是COM。如果您在依赖性Walker / Viewer 中打开.NET或非.NET .dll,则可以轻松查看这些差异。



以下是我之前制作的本机c ++ ActiveX dll(请注意右侧的 DllRegisterServer 导出):





这里是一个托管的.dll。 (请注意,无出口更不用说DllRegisterServer):





如果您将c#类标记为COM可见,则可以通过调用以下方式完成COM注册:



regasm assemblyFile [options]



a href =http://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.110).aspx =nofollow noreferrer>告诉我更多



这将将必要的条目放入Windows注册表。



不需要GAC,因为本机COM客户端(VB6)不要使用GAC


I have a Classic ASP website with vb6 dll's and all is ok with the world, but now I have some extra functionality that has been completed using c# into a COM DLL. In the dev environment this is working, but now I wish to move this DLL onto another machine.

My question is what is the best way to do this?

I have seen answers such as "add it to the GAC" or, "in needs a strong name", etc.

What happened to the good old regsvr32?

解决方案

Regsvr32 is still relevant today but you can't use it with .NET, only native DLLs. .NET has a special way to register COM-types as we shall soon see.

Regsvr32 works by invoking the DllRegisterServer export. DllRegisterServer gives the library a chance to register COM classes; type libraries; interfaces etc. This export is not present in .dlls created by .NET which makes sense because they are not COM by default. You can easily see these differences if you open up a .NET or non-.NET .dll in Dependency Walker/Viewer.

Here's a native c++ ActiveX dll I made earlier (Note the DllRegisterServer export on the right):

And here is a managed .dll. (Note there are no exports let alone DllRegisterServer):

If you have marked your c# class as COM-visible then you can complete the COM-registration by invoking:

regasm assemblyFile[options]

Tell me more

This will place the necessary entries into the Windows Registry.

There is no need for the GAC because native COM clients (VB6) do not use the GAC

这篇关于安装一个c#com dll供vbscript classic asp网站使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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