|
.net service instantiating sw object
hello everyone,
i'm attempting to use the sw api in a .net windows service to convert some files from slddrw to tiff. it seems that the sw activex object cannot be successfully instantiated while no windows user profile is loaded (defeating the purpose of this being a service). the error message i receive is "activex object cannnot be instantiated."
i initially configured the service's installer to employ a role account (local admin, for testing) and that produced the same error.
thinking that all would be well if the required libraries were available to the service, i exported the sw-related key structure of hkey_current_user and imported it into hkey_local_machine. unfortunately, it didn't work (i then restored the original keys).
i'm running out of options - does anyone have any ideas? i'd really appreciate your suggestions!
.net programmer
i'm pretty sure it can't be done. i did explain why not long ago somewhere on this forum but i can't recall the exact reasons; i just remember i did some testing and research and the conclusion was it wouldn't work.
to get definate confirmation just email apisupport
i've managed to get it working - i permitted the service to interact with the desktop and to execute it under a role account that is a member of local admins.. but that resulted in an error message of "'retrieving the com class factory for component with clsid {325c722a-1882-4657-aef8-824f6ffc2751} failed due to the following error: 80080005' "
so, i used windows' component services (dcom config) to assign the role account to be the sw 2007 app's identity, but...
it then encountered an issue (using vs 2005, .net v2.0.50727) where the instantiation of solidworks.interop.sldworks.sldworks would result in an error message of "this application has requested the runtime to terminate it in an unsual way" being thrown by the visual c++ runtime.
i hit ms support's website and found this hotfix:
andrew: well done on persevering.
when it comes to programming ... nothing beats that! (not that i'm an expert )
...3d apps... can anyone live without them?
haha, thanks andries - i wouldn't call myself an expert either, yet. it was a discussion between luke and konstantin that tipped me off to enabling "interact with desktop" for the service, so luke's numerous contributions certainly helped. i just refused to deviate from my ideal design.
knowing that, it was very straightforward to modify the installer's constructor to flip the required bit and then just some reading up on dcom (which predates my windows programming, haha).
thanks luke, by the way - if there was a .net solidworks api book available, i'd have already bought it! best of luck with your project.
.net programmer
edited: 01/08/2009 at 10:44 am by andrew maxwell
quick |
|