How to fix “The requested resource is in use. (Exception from HRESULT: 0x800700AA)”

后端 未结 6 613
青春惊慌失措
青春惊慌失措 2020-12-14 20:06

How can I solve this error?

\"The requested resource is in use. (Exception from HRESULT: 0x800700AA)\".

This appears while navi

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 20:39

    bool go = false;
    string SiteContent1 = string.Empty;
    string SiteContent2 = string.Empty;
    int index = 0;
    WebBrowser wb = new  WebBrowser();
    
        void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
    
            try
            {
                if (go)
                {
                    SiteContent2 = wb.DocumentText;
                    // Code to compare to contents of the webbrowser
                    index++;
                    go = false;
                    steps = 1;
                }
    
                if (!go)
                    {
    
                        if (index >= TotalSiteCount)
                        {
                            Stop();
                        }
                        else if (steps == 1)
                        {
                            wb.Navigate(UrltocompareList[index].Url1);
    
                        }
                        else if (steps == 2)
                        {
                            SiteContent1 = wb.DocumentText;
                            wb.Navigate(UrltocompareList[index].Url2);
                            go = true;
                        }
                        steps++;                        
                    }
    
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
    
            }
    
        }
    

    UrltocompareList is a collection of 2 sites to compare.
    TotalSiteCount is the number of items in UrltocompareList.
    The form for this inherit IOleClientSite to remove media such as images, videos and no active X download to have a faster rendering time in webbrowser control.

    I use this method instead of system.net.webclient to get the html of a webpage then compare them.
    I got this error when it hits the wb.Navigate method.

提交回复
热议问题