1

我已经在运行 Devian 的树莓派模型 a 上安装了单声道。我可以使用 HTTPWebRequest 调用常规网页,但调用 WCF 服务会导致调用超时。这是代码:

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));
                }
            }
        }
    }
}
} 

堆栈跟踪是

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 
4

0 回答 0