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

查看:441
本文介绍了将一个相当简单的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?

帮助! (o:

编辑:这个特定的问题现在解决了,因为罗伯特·罗斯尼指出,我不能做任何事情在经典的ASP DataSet,这导致我post第二个问题这里关于实现XmlTextWriter - Robert如果你看到

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!

推荐答案

不,(静态/无ctor)不是真的,完全相反,实际上,因为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天全站免登陆