By default the account used run wep application has very limited access to
the computer resources (ASPNET, Network sevice, or IUSER_XXXX, depending on
your OS and the wep app's configuration). AutoCAD, as a compicated, rich
desktop application, certainly demanding more resources. So, you need to
configure your web app (web services, in your case) to run under a user
account with enough previlige. You might have to consider to impersonate to
a local power user or a domain account.
With that said, using AutoCAD in a service, especially a web service, is
highly not recommended. For example, just openning a drawing in Acad, you
may run into many possible problems that are very likely result in a message
box pops up and block the Acad from continuing. Do yo expect some go to the
server room so often to dismiss these possible message boxes?
Also, to use Acad this way, you may violate the Acad lisence (I am not very
certain on this, though).
wrote in message news:5613584@discussion.autodesk.com...
Hey,
I want to read a custom property inside a .dwg file. I have the follwing
code (c#) inside a web service (on the web server we have autocad installed)
:
AcadApplication theApp = null;
AcadDocument theDoc = null;
try
{
// try get a running instance first
// if this fails it throws an exception
theApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.17");
}
catch
{
// try to create a new instance of autocad
theApp = new AcadApplication();
}
theDoc = theApp.Documents.Open(Documentpath, null, null);
string theValue = string.Empty;
theDoc.SummaryInfo.GetCustomByKey(propertyName, out theValue);
if (theDoc != null)
theDoc.Close(false, null);
This code doesn't work when run under IIS using the default IUSR_XXX user. I
works when run under a console applicatio n or using the visual studio web
server (which runs under the current user), but the first time always give a
problem creating an instance of the application object When autocad is
already running is works fine. Does anyone have a clue.
Also is it possible to read custom properties from the summaryinfo without
having autocad installed?
regards,
Henk