Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Timeout exception HttpWebRequest.GetResponse() in Mono 5.X

$
0
0

I realize this might not be the best place to post an issue with Mono, but I'll do it in case someone encountered a similar issue.

I have this code:

string apiUrl = "https://url.to.server/name/of/request";

System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(apiUrl);
webRequest.ContentType = "text/json";
webRequest.Accept = "Accept-application/json";
webRequest.Method = "GET";
webRequest.Headers.Add("tokenId", "00000000-0000-0000-0000-000000000000");

webRequest.AutomaticDecompression = System.Net.DecompressionMethods.Deflate | System.Net.DecompressionMethods.GZip;
webRequest.CookieContainer = new System.Net.CookieContainer();
webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;

try
{
    System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)webRequest.GetResponse();

    System.Diagnostics.Debug.WriteLine(response);
}
catch (Exception ex)
{
    System.Diagnostics.Debug.WriteLine(ex);
}

Prior to Mono 5.X, this has worked fine and returned with the response without much issue. Since Mono 5.0 and later, this has stopped working and instead throw a Timeout on GetResponse consistently. I've been building my release with Mono 4.8.1 for a few months because of this issue, but building the UnifiedAPI version with the static registrar with Xamarin Studio and Mono 4.8.1 fails.

I don't think this is an issue with HttpWebRequest per se. But with the Mono implementation and maybe the server I'm connecting to? That being said, there is definitely something different regarding the HttpWebRequest between Mono 4.8.1 and 5.0.

Any ideas?

I'll keep investigating and if I find anything more concrete, I'll file a bug.


Viewing all articles
Browse latest Browse all 204402


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>