vb.netvisual-studiocomexception

VB The object invoked has disconnected from its clients


I have a console app that interacts with internet explorer to do a few things.

Basically, the app runs perfectly normal in debug/release mode out of VS 2015 professional.

Once published in debug or release mode as an exe, I get the error you see in the post title.

Does anyone have experience with this happening?

Thank you in advanced.

enter image description here

I wanted to also add that when the program first starts after being published it works, it uses a .dll from a class library I made in another project it gets the internet explorer makes it visible then fails.

  Public Shared Function func_getIe(strIntialUrl As String) As InternetExplorer

    Dim ie As InternetExplorer

    ie = New InternetExplorer
    ie.Visible = True
    ie.Navigate(strIntialUrl)
    While ie.ReadyState <> 4
    End While
    Return ie
End Function

That is the code from one part of the .dll that is almost the very first thing, aside from some variable declaration in the beginning of the Main().


Solution

  • Hey guys found a great answer here:

    If the link dies, here is what they said to do:

    System.Runtime.InteropServices.COMException : “The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))"
    

    StackTrace:

    at SHDocVw.InternetExplorerClass.set_Visible(Boolean pBool)

    at ProtectedModePOC.Form1.button1_Click(Object sender, EventArgs e) in D:\ProtectedModePOC\Form1.cs:line 38

    Protected Mode Settings : Internet-Off and Intranet-On

    Exception:

    System.Runtime.InteropServices.COMException : “The interface is unknown. (Exception from HRESULT: 0x800706B5)”
    

    StackTrace:

    at SHDocVw.InternetExplorerClass.set_Visible(Boolean pBool)

    at ProtectedModePOC.Form1.button1_Click(Object sender, EventArgs e) in D:\ProtectedModePOC\Form1.cs:line 38

    I am getting this exception when setting Visible property of InternetExplorer object to true. This is observed only when trying to navigate to an Intranet application with Protected Mode Settings different for Internet and Intranet zones. If Protected Mode is kept On or Off for both Internet and Intranet Zone (keeping it same for both zones), problem disappears.

    If I turn off UAC (User Access Control) the exception doesn’t occur, even if the Protected Mode setting is different for Internet and Intranet zones.

    Answer: Go to IE options, under security for both intranet and internet the enable or disable protected mode needs to match.

    In my case, our admins force internet to be protected, so I had to be in protected mode for intranet too.

    While I can't say I understand how it works exactly, I can say I had no problems until attempting to navigate to the intranet. So that might explain the "disconnected" part of the exception.

    Hope this helps someone.