转换一个相当简单的C#类库为COM对象? [英] Converting a fairly simple C# Class library into a COM object?

查看:140
本文介绍了转换一个相当简单的C#类库为COM对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的问题:我要调用Web服务从一个返回复杂数据类型的经典ASP页页眉安全。对于有关第三方工具种种原因它必须是传统的ASP。我们决定,我应该创建一个外部DLL来做到这一点 - 我做到了(在C#),所以它返回一个数据集(ASP的东西能理解)。不过现在我需要的功能暴露给ASP页。因为这是传统的ASP我认为唯一的直接的方式做,这是揭露这个类库为COM对象。我需要知道下来,脏最简单的方法来完成这项任务。我有什么做我的DLL?_爱
我从来没有创建了一个COM对象之前仅使用。有人说我的类必须是静态的,我不能有一个构造函数。这是真的?谁能布局我的步骤?

Here's my problem: I have to call a web service with a secure header from a classic ASP page that returns a complex data type. For various reasons concerning a 3rd party tool it has to be classic ASP. We decided that I should create an external dll to do this - which I did (in c#) so it returns a dataset (Something ASP can understand). However now I need to expose that function to the ASP page. Because this is classic ASP I think the only straightforward way to do this is to expose this class library as a COM object. I need to know the down and dirty easiest way to accomplish this task. What do I have to do to my dll?

I have never created a COM object before only used. Somebody said my class has to be static and I can't have a constructor. Is this true? Can someone layout the steps for me?

HELP! (O:

编辑:这具体问题,现在不过是解决了罗伯特Rossney指出我不能做到与传统的ASP DataSet中任何事情。这使我发布的第二个问题<一href=\"http://stackoverflow.com/questions/301045/problem-implementing-xmltextwriter-in-new-xmlrecordsetwriter-for-streams\">here关于实施的XmlTextWriter - 罗伯特·如果你看到这一点,我认为你可以真正帮助!

This specific problem is now solved however as Robert Rossney noted I can't do anything with the DataSet in classic ASP. This has led me to post a second question here regarding implementing XmlTextWriter - Robert if you see this I think you could really help!

推荐答案

没有,那(静态/无构造函数)是不正确的。恰恰相反,事实上,因为COM将需要创建一个实例!您只需使课堂COM可见。主要是,这只是增加了一些属性,并注册它作为一个COM DLL(regasm)。

No, that (static/no ctor) isn't true. Quite the opposite, in fact, since COM will need to create an instance! You simply need to make the class COM visible. Mainly, this is just adding some attributes, and registering it as a COM dll (regasm).

http://msdn.microsoft.com/en-us/library/ zsfww439.​​aspx

这篇关于转换一个相当简单的C#类库为COM对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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