3
votes

I used html agility pack to implement one site_search module. It worked in the local machine. Then uploaded to server and while debugging in the server(as localhost while debugging through remote desktop) it worked fine . But failed to connect while accessing it through IP address of server. It shows the error in code

" Dim webGet = New HtmlWeb Dim document = webGet.Load(baseUrl) "

The Error details are

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Source Error:

Line 37: Line 38: Dim webGet = New HtmlWeb Line 39: Dim document = webGet.Load(baseUrl) Line 40: For Each link As HtmlNode In document.DocumentNode.SelectNodes("//a[@href]") Line 41: Dim att As HtmlAttribute = link.Attributes("href")

Stack Trace:

[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond] System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239 System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebException: Unable to connect to the remote server] System.Net.HttpWebRequest.GetResponse() +5386653 HtmlAgilityPack.HtmlWeb.Get(Uri uri, String method, String path, HtmlDocument doc, IWebProxy proxy, ICredentials creds) +826 HtmlAgilityPack.HtmlWeb.LoadUrl(Uri uri, String method, WebProxy proxy, NetworkCredential creds) +59 HtmlAgilityPack.HtmlWeb.Load(String url, String method) +96 HtmlAgilityPack.HtmlWeb.Load(String url) +11 AdminSiteIndex.btnIndex_Click(Object sender, EventArgs e) in C:\inetpub\wwwroot\TCIPLWEB\AdminSiteIndex.aspx.vb:39 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5420

Please help me with your valuable comments.

1
perhaps the IUSR or NETWORK SERVICE users dont have sufficient privileges to make external requests.cillierscharl

1 Answers

1
votes

You probably need to increase your timeouts on your server. 30 seconds goes by quick debugging.

    <system.web>
            <httpRuntime executionTimeout="180"/>
    </system.web>