1

I have installed mono on a raspberry pi model a, running Devian. I can use an HTTPWebRequest to call a regular web page, but calling a WCF service causes the call to timeout. Here is the code:

using System;
using System.Net;
using System.IO;
using System.Text;

namespace TestWeb
{
    class MainClass
{
    public static void Main (string[] args)
    {
        var r = (HttpWebRequest)WebRequest.Create ("https://eventboardstaging2.falafel.com/ConferenceService2/ConferenceListEx?dummy=634924037818870000");
        r.Method = "POST";
        r.ContentType = "application/json; charset=utf-8";

        string json = "{\"PrivateLabel\":\"\",\"UserID\":\"46bff210-95fb-4292-8fe8-e3d99c86b97d\",\"UtcCutoff\":null}";

        byte[] data = Encoding.UTF8.GetBytes(json);

        using (var req = r.GetRequestStream()) {
            req.Write(data, 0, data.Length);
            using (var response = r.GetResponse()) {
                using (StreamReader sr = new StreamReader(response.GetResponseStream())) {
                    var s = sr.ReadToEnd ();
                    Console.WriteLine (s.Substring(1,100));
                }
            }
        }
    }
}
} 

Stack trace is

Unhandled Exception: System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in    <filename unknown>:0 
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 
at TestWeb.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 
at TestWeb.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 
leppie
  • 115,091
  • 17
  • 196
  • 297
John Waters
  • 689
  • 2
  • 8
  • 16
  • List the stacktrace please, if possible. – leppie Jan 02 '13 at 05:32
  • OK, added the stack trace. – John Waters Jan 03 '13 at 16:23
  • Does the same code work in normal Mono or on Windows? – leppie Jan 03 '13 at 16:48
  • Yes, it works in Windows on all versions of the .net framework. I read something in some forum, I forget where, about webrequest specifically to WCF services timing out. – John Waters Jan 03 '13 at 20:40
  • I had a similar problem, probably caused by this bug: [http://stackoverflow.com/questions/11805729/datetime-tostring-in-mono-return-invalid-date-00-734718-0001-014138](http://stackoverflow.com/questions/11805729/datetime-tostring-in-mono-return-invalid-date-00-734718-0001-014138) – weberph Jan 03 '13 at 20:44
  • @weberph - where is the date problem in this? cant figure out where DateTime come in use here. Please explain us. – BerggreenDK Feb 25 '13 at 22:33
  • @BerggreenDK - the DateTime problem was caused by the hard-float version of raspbian. WCF seems to rely on DateTime internally, maybe for handling timeouts? – weberph Mar 03 '13 at 12:13
  • Strange, because my own tests (so far and uncomplete though) shows me that DateTime works okay on Raspberry, if I retreive the values one at a time, like DateTime.month etc. – BerggreenDK Mar 04 '13 at 08:39

0 Answers0