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();
I don't know if help to found the problem, but I am calling the ApprenticeServerComponent from an C# Windows Service
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.
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.
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:
Regards,
Philippe.
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.
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
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.
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?
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
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.
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
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
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...
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?
I'm not sure, that for you to sort out, sorry...
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
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,
Can't find what you're looking for? Ask the community or share your knowledge.