Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ApprenticeServerComponent error

22 REPLIES 22
Reply
Message 1 of 23
FRPT1257
1786 Views, 22 Replies

ApprenticeServerComponent error

I am getting the following error when using the ApprenticeServerComponent in C#:

 

"Retrieving the COM class factory for component with CLSID {C343ED84-A129-11D3-B799-0060B0F159EF} failed due to the following error: 80040154."

 

The error appears in the following line:

ApprenticeServerComponent oApprentice = new ApprenticeServerComponent();

 

22 REPLIES 22
Message 2 of 23
FRPT1257
in reply to: FRPT1257

I don't know if help to found the problem, but I am calling the ApprenticeServerComponent from an C# Windows Service

Message 3 of 23
philippe.leefsma
in reply to: FRPT1257

I don't think it is supported to run Apprentice from a service. Did you try the exact same code from a normal executable?

 

Your service probably doesn't have the correct permissions at the registry level, which is causing an error when trying to launch the COM component.

 

Is using a service an absolute technical necessity for your task? I would rather recommend to avoid that approach...

 

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 4 of 23
FRPT1257
in reply to: philippe.leefsma

I have tried exactly the same code from na normal executable and worked well.

 

What permissions are necessary?

 

Yes, it is. I don’t see another way.

We want synchronize iProperties with properties in SQL Database. Inventor files are in a server and I need actualize some iProperties in that files when they are changed in SQl Server database. The solution is: to have a service looking in SQL database to know when properties in SQL are changed and they open each file with Apprentice and set the value of the iProperty.

Message 5 of 23
philippe.leefsma
in reply to: FRPT1257

I don't have further suggestions concerning running Apprentice in a classic service, not supported means that you can try to do it but we don't provide support if you encounter issues.

 

It is probably possible to access your sql database from a WCF service:

 

http://stackoverflow.com/questions/10247351/how-should-i-access-sql-server-from-a-wcf-service-soluti...

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 6 of 23

Here is some more feedback about it from the development team:

 

It definitely is unsupported. But it can be made to work:  Error 80040154 is ‘class not registered’.  The issue is that service processes run under a different user account than the regular user, so any user specific registry entries or paths (stuff like LOCALAPPDATA) will be different.  If you run the service as a specific user (where this works) I would expect it to work.  You could make sure the apprentice component registrations are done under the ‘local system’ user account, or in the ‘all users’ area of the registry. Or you could make sure the host process uses a sxs manifest with the correct component registrations for Apprentice.

 

Hope that helps,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 7 of 23
FRPT1257
in reply to: philippe.leefsma

I configured the service properties to run the service was Log on as Local system account, but without success.

 

How do I see if Apprentice component registrations are done under the ‘local system’ user account or in the ‘all users’?

 

Could you give me more information about how to do an sxs manifest with the correct component registration for Apprentice? Do you have same sample?

 

Thanks & Regards,

Rui

Message 8 of 23
philippe.leefsma
in reply to: FRPT1257

I don't have any sample sorry, that's an unsupported topic that you would need to investigate on your own.

 

The best suggestion I could give you is to take another route as I mentioned previously, if you choose to go that path, you will need to sort it out mostly by yourself unless somebody on the forum has experience with that unusual request.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 9 of 23
FRPT1257
in reply to: philippe.leefsma

If I configure my service properties to Log on with the logged user works well. But if I keep the service running with the Local System account don’t work.

What must I change to the Local System account to work with this account?

Message 10 of 23
FRPT1257
in reply to: FRPT1257

I have changed my code to call ApprenticeServerComponent from a webservice instead of the first approach of call ApprenticeServerComponent from a Windows Service.

 

But the problem is exactly the same, when webservice in IIS call the ApprenticeServerComponent I get exactly the same error. 😞

If I run webservice from VStudio works well, but when I publish it to IIS I get the same COM error.

 

What could I change in IIS to make it work?

 

Thanks & Regards,

Rui

Message 11 of 23
rjay75
in reply to: FRPT1257

This is still the same issue as running it from a service. The user the IIS server uses runs as a non Interactive user. If it's an internal only webservice you can set the user mode to run in as interactive. See this link and here.

Message 12 of 23
philippe.leefsma
in reply to: rjay75

Rodney is correct, you will hit the same issue as previously... An easy path would be to host a WCF service in an executable, I've done it successfully in the past to run Apprentice on the Cloud. This will be probably a painless solution comparing to what you seem to go through.

 

Hope that helps,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 13 of 23
FRPT1257
in reply to: philippe.leefsma

What you mean with “host a WCF service in an executable”?
I can create a WCF service that call Apprentice, and can run that WCF service as a Windows service (or host WCF service as an Windows service)?
Message 14 of 23
philippe.leefsma
in reply to: FRPT1257

Please try typing "host a WCF service in an executable" in a search engine, you should easily hit some tutorials.

 

Here are some I'm grabbing for you:

 

http://msdn.microsoft.com/en-us/library/vstudio/ms731758%28v=vs.100%29.aspx

 

http://www.codeproject.com/Articles/650869/Creating-a-Self-Hosted-WCF-Service

 

http://www.codemag.com/Article/0701041



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 15 of 23
FRPT1257
in reply to: philippe.leefsma

Do you mean that I can create an WCF Service (that call the ApprenticeServerComponent) hosted in IIS or in a managed Windows service application?

 

This will not have the same problem I got calling ApprenticeServerComponent from a WebService or directly from a Windows service application?

 

Thanks & Regards,

Rui

Message 16 of 23
philippe.leefsma
in reply to: FRPT1257

A WCF Service that instanciate Apprentice and which is hosted in an executable. This will not be affected by the limitations of IIS or a windows service and will provide the same features than a service hosted in IIS. Read the doc to get a better idea about how it works. You will be able to remotely connect to your service and perform some tasks involving Apprentice...



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 17 of 23
FRPT1257
in reply to: philippe.leefsma

But if it is hosted in an executable, this executable cannot be running in background.

 

Need to be logged in server/computer for this executable be running. Am I right?

 

Or I can start this "executable" without logon into server/computer?

Message 18 of 23
philippe.leefsma
in reply to: FRPT1257

I'm not sure, that for you to sort out, sorry...



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 19 of 23
FRPT1257
in reply to: philippe.leefsma

I just need to change iProperties in background, not a bigger thing with need of user interaction.

 

The only way is use a heavy activeX like ApprenticeServerComponent?

 

There are not exist a more simple and managed DLL for doing just this?

 

Thanks & Regards,

Rui

Message 20 of 23
adam.nagy
in reply to: FRPT1257

Hi Rui,

 

I'm not aware of any other component for this than apprentice.

I need to reiterate what Philippe said about using Apprentice from a Windows Service not being supported.

 

Still, since this topic came up a few times I thought I'd look into it and blog about it:
http://adndevblog.typepad.com/manufacturing/2014/07/using-apprentice-from-a-windows-service.html

 

I hope this helps.

 

Cheers, 



Adam Nagy
Autodesk Platform Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums