問題:瀏覽器可以正常取得JSON資料,但使用C# HttpClient取資料,執行緩慢。
ChatGPT:其中一種原因。可能有使用Proxy。
解法:將Proxy關閉。
HttpClientHandler handler = new HttpClientHandler
{
Proxy = null,
UseProxy = false
};
HttpClient client = new HttpClient(handler);
HttpClientHandler handler = new HttpClientHandler
{
Proxy = null,
UseProxy = false
};
HttpClient client = new HttpClient(handler);