自动化服务器无法创建对象

发布于 2024-11-30 09:00:00 字数 272 浏览 0 评论 0原文

我正在编写一个 C# 对象,我需要能够从 javascript 应用程序访问该对象。

var util = new ActiveXObject('Namespace.Class');

但是,当我尝试创建对象时,出现错误:“异常:自动化服务器无法创建对象。”我已经为 COM 互操作注册了对象,并且程序集已签名。

注意:这不是网页,也不会在浏览器中运行。我能够以同样的方式创建其他 COM 对象,因此我的安全设置已经设置,并且我的脚本引擎正在运行。

I am writing a C# object that I need to be able to access from a javascript application.

var util = new ActiveXObject('Namespace.Class');

However, when I attempt to create the object I get an error saying, "Exception: Automation server can't create object." I have registered the object for COM interop and the assembly is signed.

NOTE: This is NOT a webpage and is NOT being run in the browser. I am able to create other COM objects in this same way, so my security settings are already set, and my script engine is working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

箜明 2024-12-07 09:00:00

好吧,我是 COM 新手。原来我没有将 com 可见设置为 true。希望这对某人有帮助!

[ComVisible(true)]

Ok I'm just new to COM. Turns out I did not set com visible to true. Hope this helps someone!

[ComVisible(true)]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文