gpt4 book ai didi

URI 太长了

转载 作者:行者123 更新时间:2023-12-01 06:36:55 25 4
gpt4 key购买 nike

在添加我得到的参数后,我正在使用 RestClient 和 RestRequest 发出请求

错误:

Invalid URI: The URI string is too long. 

我假设这与它没有正确发布数据有关,这是我的代码:
RestClient client = new RestClient();
client.BaseUrl = "URL";
client.Authenticator =
new HttpBasicAuthenticator("api",
"KEY");
RestRequest restRequest = new RestRequest(Method.POST);
restRequest.AddParameter("domain",
"DOMAIN", ParameterType.UrlSegment);
restRequest.Resource = "{domain}/messages";
restRequest.AddParameter("from", (string) sender["alias"] + "<email>");
restRequest.AddParameter("to", (string)recipient["alias"] + "<" + (string)recipient["email"] + ">");
restRequest.AddParameter("subject", subject);
restRequest.AddParameter("html", body);
var result = client.Execute(restRequest);
if (result.StatusCode != System.Net.HttpStatusCode.OK)
{
throw new Exception(result.ErrorMessage,new Exception(result.StatusCode + " - " + result.StatusDescription));
}

body 参数可能很长,因为它是 HTML 电子邮件。出现上述错误的原因是什么?

这是代码使用较短主体发出的请求,以便它确实发送
http://pastebin.com/HgbBHVpC

完整的堆栈跟踪,包括尝试发送的消息 http://pastebin.com/dRhXire6

最佳答案

http://msdn.microsoft.com/en-us/library/z6c2z492.aspx

查看它说的文档
uriString 的长度超过 65519 个字符

关于URI 太长了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13954927/

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