[英]How do I consume a COM+ local server from C#?
I have a web application from a company that has gone out of business. 我有一家停业的公司的Web应用程序。 We're looking to extend the web app a bit with some asp.net functionality.
我们希望通过一些asp.net功能扩展Web应用程序。 The web app was written as an ISAPI application in Delphi, and uses COM+ to talk to the SQL Server and handles things like session management and authentication.
该Web应用程序是在Delphi中作为ISAPI应用程序编写的,并使用COM +与SQL Server进行通信并处理会话管理和身份验证之类的事情。
So, in order to get the current user and other details, I have to use the undocument COM+ components. 因此,为了获得当前用户和其他详细信息,我必须使用无文档的COM +组件。 I was able to dig out the type library and auto generated IDL, but at this point i'm lost in creating a .NET proxy class for this.
我能够挖掘出类型库并自动生成IDL,但是此时我迷失了为此创建一个.NET代理类的情况。
Is there a way to autogenerate the .net COM+ proxy either from the .dll itself (extracting the typelib info) or from the IDL? 是否可以从.dll本身(提取typelib信息)或从IDL自动生成.net COM +代理?
Note: These seem to be simple COM style objects hosted in COM+ servers, no subscriptions or transaction monitoring.. 注意:这些似乎是在COM +服务器中托管的简单COM样式对象,没有订阅或事务监视。
You could use tlbimp.exe to generate C# proxy classes from your COM library. 您可以使用tlbimp.exe从COM库生成C#代理类。
tlbimp.exe myTest.tlb /out:myTest.dll
If you don't have the tlb
it works also with COM dlls
. 如果您没有
tlb
它也可以与COM dlls
。 Once the COM wrapper assembly generated you can reference it in your project and use the types inside as you would any other .NET class. 一旦生成了COM包装器程序集,就可以在项目中引用它,并像使用其他任何.NET类一样使用内部的类型。
Possible location of tlbimp.exe
: C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Bin\\TlbImp.exe
or use the Visual Studio Command Prompt. tlbimp.exe
可能位置: C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Bin\\TlbImp.exe
或使用Visual Studio命令提示符。
在类型库上运行Tlbimp.exe为其生成.NET互操作程序集。
Have you tried going to the references in your project, right clicking, add reference, then browsing to the dll. 您是否尝试过访问项目中的引用,右键单击,添加引用,然后浏览到dll。 I think visual studio will generate the Runtime Callable Wrapper for you.
我认为Visual Studio将为您生成Runtime Callable Wrapper。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.