当我使用 ObjectContent 对象创建 HttpContent 以通过 HttpClient 向 Web API 服务发送请求时,我收到以下错误:
无法将比配置的最大缓冲区大小更多的字节写入缓冲区:65536
以下代码用于发送请求。Card 对象有大约 15 个属性。
var client = new HttpClient();
var content = new ObjectContent<IEnumerable<Card>>(cards, "application/xml");
MessageBox.Show(content.ReadAsString()); //This line gives me the same error.
var response = client.Post("http://localhost:9767/api/cards", content);
如何将配置的大小更改为大于 65,536?