几何尺寸与公差论坛

 找回密码
 注册
查看: 963|回复: 0

【转帖】net service instantiating sw objec

[复制链接]
发表于 2009-4-12 17:22:40 | 显示全部楼层 |阅读模式
.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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 19:30 , Processed in 0.035912 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表