gpt4 book ai didi

c# - WebClient.UploadString 方法的最大数据长度

转载 作者:行者123 更新时间:2023-11-30 23:08:33 27 4
gpt4 key购买 nike

我的 asp.net mvc 应用程序中有以下代码 -

string URI = "http://send.url.com/smsapi/sender.php";     
string queryParameters= "a long query string";

string xmlResult = "";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
xmlResult = wc.UploadString(URI, queryParameters);
}

我的问题是 queryParameters 可以用于 WebClient.UploadString 方法多长时间?

最佳答案

WebClient 类对字符串的长度实现无限制。就它而言,它正在传输数据字节。

Reference Source if you want to check yourself

And the method it calls

唯一的理论限制是 Int32.MaxValue 字节,因为内部转换/编码方法使用 int (~2GB)。只要 Encoding.GetBytes 可以处理它并且您有足够的 RAM,您就不太可能在此之前受到限制。

关于c# - WebClient.UploadString 方法的最大数据长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46446081/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com