[Mono-dev] WebRequest time out error

LeMoussel cnhx27 at gmail.com
Sat Jan 30 11:35:41 UTC 2016

I tried to build an application with Linux/Mono "version 4.2.1 Stable", but I got the following errors (Rem: No error on Windows

    Unhandled Exception:
    System.Net.WebException: The remote server returned an error: (504)
Gateway Time-out.
      at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
<0xb464dc48 + 0x0018c> in <filename unknown>:0
      at System.Net.HttpWebRequest.GetResponse () <0xb4646470 + 0x0006b> in
<filename unknown>:0

The bit of code causing this issue is:

        WebProxy webProxy = new WebProxy(proxyUri, true);
        webProxy.Credentials = new NetworkCredential(proxyUserName,
        WebRequest request = WebRequest.Create(targetUri);
        request.Proxy = webProxy;
        request.Method = "CONNECT";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();	
        Stream responseStream = response.GetResponseStream();

It failed immediately with Time Out error. The code is crashing on the line:
`HttpWebResponse response = (HttpWebResponse)request.GetResponse();`

What is causing this to happen and how can I fix it?

View this message in context: http://mono.1490590.n4.nabble.com/WebRequest-time-out-error-tp4667345.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list