이 질문에 대한 답변이 이미 여러 번 나왔지만 불행히도 나를위한 답변이 없습니다.WebClient.DownloadString()이 반복적으로 다운로드 속도가 느려집니다.
나는 WebClient.DownloadString()을 사용하고 있으며 실행 속도가 매우 느리다. WebClient.Proxy를 null로 설정하려고 시도했으며 GlobalProxySelection.GetEmptyWebProxy()가 작동하지 않았다. 인터넷 속도. 내가 도대체 뭘 잘못하고있는 겁니까? 브라우저 URL에 URL을 호출하는 동안
는public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var res = GetData("tp");
ShowData(res);
res = GetData("nl");
ShowData(res);
res = GetData("sp");
ShowData(res);
res = GetData("en");
ShowData(res);
res = GetData("in");
ShowData(res);
res = GetData("st");
ShowData(res);
res = GetData("sh");
ShowData(res);
res = GetData("fl");
ShowData(res);
res = GetData("ce");
ShowData(res);
}
public IEnumerable<object> GetData(string playListName)
{
try
{
String url = string.Empty;
string jsonStr = string.Empty;
if (playListName == "tp")
url = "https://content.jwplatform.com/feeds/wDg7QXiZ.json";
else if (playListName == "nl")
url = "https://content.jwplatform.com/feeds/ZluqvHh7.json";
else if (playListName == "sp")
url = "https://content.jwplatform.com/feeds/CqjyIXVZ.json";
else if (playListName == "en")
url = "https://content.jwplatform.com/feeds/FEvaC7IT.json";
else if (playListName == "in")
url = "https://content.jwplatform.com/feeds/7HSiwnEm.json";
else if (playListName == "st")
url = "https://content.jwplatform.com/feeds/ioE6BWAD.json";
else if (playListName == "sh")
url = "https://content.jwplatform.com/feeds/XHZFlpw1.json";
else if (playListName == "fl")
url = "https://content.jwplatform.com/feeds/N2gtCgnE.json";
else if (playListName == "ce")
url = "https://content.jwplatform.com/feeds/Lw3otpHB.json";
else
url = string.Empty;
using (var webClient = new WebClient())
{
webClient.Proxy = null; // not working
//webClient.Proxy = GlobalProxySelection.GetEmptyWebProxy(); // not working
jsonStr = webClient.DownloadString(url); // take 8 to 10 seconds
}
return jsonStr;
}
catch (Exception) { return null; }
}
}
입니다 (코드의 더 넓은 맥락에서 찾고 모니터링 그것으로 탐구하지 않고 속도 저하의 주요 원인이 무엇인지 정확히 알려
프록시 측면이 속도 측면과 어떤 관련이 있는지, 또는 다른 방법으로 데이터를 검색하는 속도 (예 : 브라우저)를 테스트했는지 여부는 분명하지 않습니다. 어쩌면 서버가 느린 것일까 요? –