COMException "Requested resource in use"
-
Hello, I'm using the WebBrowser control in an application in C#. I created an UserControl embedding the WebBrowser control. I have a form including one of this UserControl. I also have a thread that makes calls to the Navigate() method of the WebBrowser control. This thread automatically navigate to several hundred of pages and sites. It waits for several minutes for a page to load and then traverse its DOM. Everything works nicely but after a while (time vary, page involved too) I always get a COMExption error when calling the Navigate() method: "Requested resource is in use". I'm really stuck with this problem which compromise the program stability. Any help or ideas will be greatly welcome. Thanks, R. LOPES Just programmer.
-
Hello, I'm using the WebBrowser control in an application in C#. I created an UserControl embedding the WebBrowser control. I have a form including one of this UserControl. I also have a thread that makes calls to the Navigate() method of the WebBrowser control. This thread automatically navigate to several hundred of pages and sites. It waits for several minutes for a page to load and then traverse its DOM. Everything works nicely but after a while (time vary, page involved too) I always get a COMExption error when calling the Navigate() method: "Requested resource is in use". I'm really stuck with this problem which compromise the program stability. Any help or ideas will be greatly welcome. Thanks, R. LOPES Just programmer.
Probably the urlmoniker has not finished to download the current web page. And, for some reason, the next Navigate() call reuses this underlying object. A few advices, although I haven't tested any of them : - release the underlying COM object (Marshal.ReleaseComObject()). - cast the current document to IMoniker and free it. (the moniker is a url moniker obtained when you navigate a url, and it does an underlying COM CreateURLMoniker(...) ). See MSDN / WalkAll for more info. - cast the current document to IPersistStream and free it. Try also with IAsyncMoniker. Both of the interfaces must be declared before used. Read my recent posts about IPersistStreamInit for more info.
-
Probably the urlmoniker has not finished to download the current web page. And, for some reason, the next Navigate() call reuses this underlying object. A few advices, although I haven't tested any of them : - release the underlying COM object (Marshal.ReleaseComObject()). - cast the current document to IMoniker and free it. (the moniker is a url moniker obtained when you navigate a url, and it does an underlying COM CreateURLMoniker(...) ). See MSDN / WalkAll for more info. - cast the current document to IPersistStream and free it. Try also with IAsyncMoniker. Both of the interfaces must be declared before used. Read my recent posts about IPersistStreamInit for more info.