Autodesk.Inventor.Interop.dll 在 Win Server 64 位 2012 R2 上 - 接口未注册

Autodesk.Inventor.Interop.dll on WinServer 64-bit 2012 R2 - interface non registred

我正在尝试开发一个基于 Autodesk Inventor 引擎的非常简单的 Web 应用程序。

我正在使用 Visual Studio 2010 和 Inventor 2015 在 Win7 64 位上进行开发,调试时一切正常,但是当我在 Web 服务器上发布时出现错误:

HRESULT: 0x800401F3 (CO_E_CLASSSTRING)

和消息

interface string not valid

我收到错误的 C# 代码行 是:

Inventor.Application _invApp = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application");

我测试的完整代码如下:

using Inventor;
using System.Runtime.InteropServices;
namespace web_debug_cs
{
    public partial class debug_runinventor : Ssytem.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e) { startInventorApplication(); }
        private void startInventorApplication()
        {
            string sDebug = string.Empty;
            try
            {
                Inventor.Application _invetorApp = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application");
                sDebug = "Success!!!";
            }
            catch (Exception ex) { sDebug = "UNSUCCESS!<br />" + ex.Message; }
            lblAnswer.Text = sDebug;
        }
    }
}

我直接从 Inventor 2015 指南中获取此代码,但是(重复)在本地机器上一切正常,但在服务器上不行。

但没有什么可以解决这个问题。

我考虑过 使用 pInvoke 手动导入 dll 的可能性,但没有成功...

我在谷歌上搜索了很多,我试图向 Autodesk 询问但没有成功。

我在服务器上启动了 Inventor 以验证它是否工作,并且工作完美!

有人可以帮我吗?

提前感谢您的回复!

埃马努埃莱

我不希望它起作用,原因很简单:网页 运行 作为服务,Inventor 作为用户级应用程序运行。想象一下:网页被 100 clients/browsers 次请求,您的应用将启动 Inventor 100 次。但更重要的是,该网页不在用户级别。

最好的工作机会是:您的网页收到一个请求(假设创建一个 .ipt 文件),创建一个必须执行该操作的记录(例如,一个带有说明的新 .txt 文件或数据库条目),Windows 服务检测请求并启动 Inventor 来处理它。在这种情况下,您将有一个队列,请求由您的网页放置,但稍后处理。

但我必须说,EULA 不支持也不允许这样做,请查看。