vb.net - Problem remaking com object after program has closed.
Have been searching for a solution to this problem for days with no luck so I decided to post here and hope someone can help me. What makes it even harder is that I can't replicate this problem on my computer very consistently. Sometimes I will get the error but most of the time I won't.

Basically what is happening is I am creating an IE object which my program then controls for a long period of time.  What is happening is, if a user exits the program it calls oIE.Quit() then closes the program. This should close internet explorer and all processes associated with it.

But, the iexplorer process doesn't end up closing. Then when the user tries to run the program again we get this error "System.Runtime.InteropServices.COMException (0x80004005): Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80004005.". 

To fix this we simply close the any iexplorer.exe processes that are open and it will let us create our ie object again. This happens also if the program crashes and they try to restart it.

I am not sure what is causing this or if I am missing something that has to do with com objects. But I am simply stuck.


Here is some code although plugging in this code likely won't reproduce any errors:

    'create ie object
    oIE = New SHDocVw.InternetExplorer
    oIE.Navigate("http://www.google.com")
    oIE.Visible = False
    oIE.Silent = True

    'kill ie object
    oIE.Quit()


vb.net - Problem remaking com object after program has closed.
===

Have been searching for a solution to this problem for days with no luck so I decided to post here and hope someone can help me. What makes it even harder is that I can't replicate this problem on my computer very consistently. Sometimes I will get the error but most of the time I won't.

Basically what is happening is I am creating an IE object which my program then controls for a long period of time.  What is happening is, if a user exits the program it calls oIE.Quit() then closes the program. This should close internet explorer and all processes associated with it.

But, the iexplorer process doesn't end up closing. Then when the user tries to run the program again we get this error "System.Runtime.InteropServices.COMException (0x80004005): Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80004005.". 

To fix this we simply close the any iexplorer.exe processes that are open and it will let us create our ie object again. This happens also if the program crashes and they try to restart it.

I am not sure what is causing this or if I am missing something that has to do with com objects. But I am simply stuck.


Here is some code although plugging in this code likely won't reproduce any errors:

    'create ie object
    oIE = New SHDocVw.InternetExplorer
    oIE.Navigate("http://www.google.com")
    oIE.Visible = False
    oIE.Silent = True

    'kill ie object
    oIE.Quit()

