0

I'm trying to build up a service that runs in background on a bunch of remote computers that will simply monitor how many times IE is used for statistics purposes. Most of my code is written and it works absolutely fine on my development computer, which has the same specs as the remote computers. I've also made sure the remote computers all have Net Framework 4.5.1.

When starting the service, I get this error message (I log it)

System.Runtime.InteropServices.COMException (0x80040202): Exception HRESULT : 0x80040202
at System.Runtime.InteropServices.ComTypes.IConnectionPoint.Advise(Object pUnkSink, Int32& pdwCookie)
at System.Runtime.InteropServices.ComEventsSink.Advise(Object rcw)
at System.Runtime.InteropServices.ComEventsInfo.AddSink(Guid& iid)
at System.Runtime.InteropServices.ComEventsHelper.Combine(Object rcw, Guid iid, Int32 dispid, Delegate d)
at System.Runtime.InteropServices.ComAwareEventInfo.AddEventHandler(Object target, Delegate handler)
at ServiceLogger.Service1..ctor()

Here is the code that causes this error, it happens when my service is created by program.cs, I have not modified program.cs.

InitializeComponent();
shellWindows = new SHDocVw.ShellWindows(); //Global var
shellWindows.WindowRegistered += shellWindows_WindowRegistered; <-- This is the error

I searched all day on google and no one seems to have this problem and it only happens on the remote computer. Is there something on those computers configuration that causes this issue? Is there a problem with the shdocvw library?

GPierre
  • 100
  • 11
  • After a quick search I found in [this answer](http://stackoverflow.com/questions/1493268/error-connecting-to-third-party-app-via-com-mscorlib-exception-from-hresult-0x): "The error code for that HRESULT is CONNECT_E_CANNOTCONNECT. This is typically returned as a failure code from IConnectionPoint::Advise because the connection point doesn't support the underlying interface." Maybe that get's you onto the right track... – Frank J Feb 24 '16 at 16:00
  • That's an error from the OPC framework, mine is from shdocvw. They're both COM extensions and that makes the error message the same and the google search a nightmare. In their case, the ONNECT_E_CANNOTCONNECT means they cannot connect to an OPC server, but i'm only trying to add an event handler to a IE window... – GPierre Feb 24 '16 at 16:37
  • I think it means the same for shdocvw since it is the same error and related to COM and not component specific. It might not support the underlying interface it is trying to use. – Frank J Feb 24 '16 at 18:20
  • They have the same version of both net framework and windows, is it possible that the version of Internet Explorer can cause this error? – GPierre Feb 24 '16 at 19:06
  • Sorry, that I do not know, somebody else might chime in here with more experience with DCOM – Frank J Feb 24 '16 at 19:07
  • Thanks, I'm rebuilding the machine right now to see if that could change anything. – GPierre Feb 24 '16 at 19:17

1 Answers1

0

Turns out it was actually a problem with Internet Explorer itself.

We wanted to prevent users from doing a lot of things on those computers, we fiddled a bit too much with IE and had to install a special version to block a lot of things.

I rebuilt the machine, tested out the service and it works fine.

GPierre
  • 100
  • 11