为什么我在RestSharp初始调用很慢?但其他人后都非常快 [英] Why is my Initial call in RestSharp really slow? but others after are very fast

查看:996
本文介绍了为什么我在RestSharp初始调用很慢?但其他人后都非常快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用RESTSHARP拨打电话到Web API和他们很好地工作。然而,(不管什么称呼它是)到API的初始呼叫有时需要花10秒得到回应。之后每隔调用是非常快。有谁知道解决的办法?

我运行一个WPF 4.0应用程序

code:

  VAR的客户=新RestClient(apiAddress);
VAR请求=新RestRequest(Method.GET);

IRestResponse响应= client.Execute(要求);
 

解决方案

这是最有可能导致此问题的网络设置。最近,我有同样的问题,事实证明,在使用的HttpWebRequest 或RestSharp有人尝试一些自动配置来寻找代理服务器。

打开Internet Explorer中的网络设置,关闭自动配置本地网络。在我的情况下,这解决了延迟在RestSharp的第一个请求为好。

I am making calls to a WEB API using RESTSHARP and they work fine. However, the Initial call to the API (regardless of what call it is) can sometimes take up to 10 seconds to get a response. Every other call after that is really quick. Does anyone know a way around this?

I am running a WPF 4.0 application

code:

var client = new RestClient(apiAddress);
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);

解决方案

It's most likely the network settings causing this problem. I recently had the same issue and it turned out that when using HttpWebRequest or RestSharp it was trying some auto configuration to look for a proxy server.

Open the network settings in Internet Explorer and disable auto configuration for the local network. In my case this resolved the delay for the first request in RestSharp as well.

这篇关于为什么我在RestSharp初始调用很慢?但其他人后都非常快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆