Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Using ActiveX In a windows service

Using ActiveX In a windows service

Scheduled Pinned Locked Moved C#
comquestionworkspace
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Big Trev
    wrote on last edited by
    #1

    I have an app which uses an ActiveX component. No problmes there. I have now converted it to run as a windows service, which also work fine when i configure the service to run using my NT Login account. However, when i configure the service to run using the System Account, i get an exception: System.IO.FileNotFoundException: The specified module could not be found. when the code tried to instantiate the ActiveX control. I have the Path to the Dll in the system environment. Does any one have any ideas? Thanks

    H 1 Reply Last reply
    0
    • B Big Trev

      I have an app which uses an ActiveX component. No problmes there. I have now converted it to run as a windows service, which also work fine when i configure the service to run using my NT Login account. However, when i configure the service to run using the System Account, i get an exception: System.IO.FileNotFoundException: The specified module could not be found. when the code tried to instantiate the ActiveX control. I have the Path to the Dll in the system environment. Does any one have any ideas? Thanks

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      With ActiveX, the PATH environment variable doesn't really matter (it can, but is not typically necessary, because...). When an ActiveX control is registered, it's server's path (the executable that contains the control) is registered in the Windows registry under HKEY_CLASS_ROOT\CLSID. This is one thing that makes COM so attractive - you don't have to worry about where the file is (thus helping to eliminate DLL hell, so long as you follow good COM guidelines about interface naming and the like). Make sure the ActiveX DLL (or OCX or whatever) is registered correctly using regsvr32.exe. The other possibility is that the interop assembly was not found. When you import an ActiveX control (or even a typelib) interop assemblies are generated, which are also called Runtime Callable Wrappers, or RCWs. Those assemblies must be either in the same directory as the service executable, in the probing path (configurable in the .config file, which must also be in the same directory as the service executable and named the same as the executable + ".config"), using the <assemblyBinding> section in your .config file, or installed into the Global Assembly Cache (GAC), which requires that the assembly be signed (it's easy, just use sn.exe -k KeyFile.snk to generate a key pair).

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups