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
  1. Home
  2. General Programming
  3. C#
  4. COMException "Requested resource in use"

COMException "Requested resource in use"

Scheduled Pinned Locked Moved C#
helpcsharphtmllearning
3 Posts 2 Posters 0 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.
  • G Offline
    G Offline
    GriffonRL
    wrote on last edited by
    #1

    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.

    S 1 Reply Last reply
    0
    • G GriffonRL

      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.

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      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.

      G 1 Reply Last reply
      0
      • S Stephane Rodriguez

        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.

        G Offline
        G Offline
        GriffonRL
        wrote on last edited by
        #3

        Hello Stephane, Thank you very much indeed. I'm going to look into these objects. If you have any other idea or anybody else, feel free to post here. Thanks, R. LOPES Just programmer.

        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