REST服务有时会起作用,但其他人不起作用c#

时间:2016-11-22 02:20:10

标签: c# json web-services rest

我有一个网络服务,可以让客户回到json。

当我针对webservice运行它并使用以下内容时:

https://mywebservice/customers?Cols=first_name -- brings back all customers

try
    {
    HttpWebRequest request = WebRequest.Create("https://mywebservice/rest/customers?Cols=first_name") as HttpWebRequest;
    request.Accept = "application/json";
    request.Timeout = 500000;
    request.ReadWriteTimeout = 5000000;
    HttpWebResponse response = request.GetResponse() as HttpWebResponse;
    Log.log(response.StatusCode.ToString());
    var encoding = ASCIIEncoding.ASCII;
    using (var reader = new StreamReader(response.GetResponseStream(), encoding))
    {
    jsonCustomers = reader.ReadToEnd();
    }
    }
    catch (Exception i)
    {
    MessageBox.Show(i.ToString());
    }

超时时出现500错误消息响应。

当我使用以下内容运行它时:

https://mywebservice/customers?Cols=first_name&filter=first_name,LK,yoyo /* brings back only customers with first name like yoyo */

这很好用,它几乎就像超时一样,但我说的是一段相当长的时间。

我有大约20K的记录,其中first_name就像'yoyo'

我总共有超过100K的记录。

谢谢,

0 个答案:

没有答案