本文介绍了部署后的AutoCAD实例没有创造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行方面使用C#AutoCAD应用程序的问题。由于我是新手我最code是从复制粘贴净

I am getting an issue regarding running autocad application using C#. As i am beginner most of my code is copy pasted from net.

问题是我使用C#,这将在运行时创建一个实例化的AutoCAD实例开发一个Web应用程序。每一件事情去开发服务器上,以及我的本地IIS服务器上的罚款。但是当我部署在服务器上的Web应用程序(窗口服务器8)本人提示以下错误:

The problem is i am developing an web application using c# which will create an instantiate autocad instance at runtime. Every thing goes fine on development server as well as on my local IIS server. but when i am deploying the web application on the server(window server 8) i am getting the below error

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
at System.Runtime.InteropServices.Marshal.GetActiveObject(Guid& rclsid, IntPtr reserved, Object& ppunk)
at System.Runtime.InteropServices.Marshal.GetActiveObject(String progID)
at DQMF.CDQMF.createAacdApplicationInstance(String progID)

我想这是因为某些特权问题。作为我的本地机器的AutoCAD实例与服务器(Windows Server 8)正在运行(与开发服务器)行政特权制度和权限运行。

I think it is because of some privilege issue. as on my local machine autocad instance is running with privilege of system and on server(windows server 8) it is running(with development server) as administrative privilege.

    AcadApplication createAacdApplicationInstance(string progID)
    {
        AcadApplication app = null;
        try
        {
            app = (AcadApplication)Marshal.GetActiveObject(progID);
        }
        catch (Exception e)
        {
            try
            {
                Type acType = Type.GetTypeFromProgID(progID);
                app = (AcadApplication)Activator.CreateInstance(acType, true);
                app.Visible = false;
                app.Width = 1;
                app.Height = 1;
                app.WindowState = AutoCAD.AcWindowState.acMin;
                app.Visible = false;
            }
            catch (Exception ex)
            {
                //File.AppendAllText("D:/test/DQMS_log.txt", ex.Message+" progID is: "+progID+Environment.NewLine+"app caption: "+app.Caption);
            }
        }
        return app;
    }

如果你想要一些更详细的我可以给

If you want some more detail i can give

推荐答案

在视觉互操作性展示工作,它不是那么简单运行的是期望从asp.net用户直接交互的应用程序的实例。

When working with visual interops, it is not as straightforward to run instances of applications that expect direct user interaction from asp.net.

您可能需要使用Windows窗体或WPF应用程序与AutoCAD的工作。这个问题可能是AutoCAD.Application互操作不允许非视觉交互。

You may have to use a windows form or WPF application to work with AutoCAD. The issue may be that the AutoCAD.Application interop does not allow for non-visual interaction.

这篇关于部署后的AutoCAD实例没有创造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 05:06