Note that there are some explanatory texts on larger screens.

plurals
  1. POProxy works locally but fails when uploaded to webhost
    primarykey
    data
    text
    <p>I have spent a good time now on configuring my proxy. At the moment I use a service called proxybonanza. They supply me with a proxy which I use to fetch webpages.</p> <p>I'm using <strong><em>HTMLAGILITYPACK</em></strong></p> <p>Now if I run my code without a proxy there's no problem locally or when uploaded to webhost server.</p> <p>If I decide to use the proxy, it takes somewhat longer but it stills works locally.</p> <pre><code> If I publish my solution to, to my webhost I get a 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 38.69.197.71:45623" </code></pre> <p>I have been debugging this for a long time.</p> <p>My app.config has two entries that are relevant for this <br></p> <pre><code>httpWebRequest useUnsafeHeaderParsing="true" httpRuntime executionTimeout="180" </code></pre> <p>That helped me through a couple of problems.</p> <p>Now this is my C# code.</p> <pre><code> HtmlWeb htmlweb = new HtmlWeb(); htmlweb.PreRequest = new HtmlAgilityPack.HtmlWeb.PreRequestHandler(OnPreRequest); HtmlDocument htmldoc = htmlweb.Load(@"http://www.websitetofetch.com, "IP", port, "username", "password"); //This is the preRequest config static bool OnPreRequest(HttpWebRequest request) { request.KeepAlive = false; request.Timeout = 100000; request.ReadWriteTimeout = 1000000; request.ProtocolVersion = HttpVersion.Version10; return true; // ok, go on } </code></pre> <p>What am I doing wrong? I have enabled the tracer in the appconfig, but I don't get a log on my webhost...?</p> <pre><code> Log stuff from app.config &lt;system.diagnostics&gt; &lt;sources&gt; &lt;source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing" &gt; &lt;listeners&gt; &lt;add name="ServiceModelTraceListener"/&gt; &lt;/listeners&gt; &lt;/source&gt; &lt;source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"&gt; &lt;listeners&gt; &lt;add name="ServiceModelTraceListener"/&gt; &lt;/listeners&gt; &lt;/source&gt; &lt;source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing"&gt; &lt;listeners&gt; &lt;add name="ServiceModelTraceListener"/&gt; &lt;/listeners&gt; &lt;/source&gt; &lt;/sources&gt; &lt;sharedListeners&gt; &lt;add initializeData="App_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp"/&gt; &lt;/sharedListeners&gt; &lt;/system.diagnostics&gt; </code></pre> <p>Can anyone spot the problem I have these setting on and off like a thousand times..</p> <pre><code> request.KeepAlive = false; System.Net.ServicePointManager.Expect100Continue = false; </code></pre> <p>Carl</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload