我收到的错误:大小限制解决方法FormUrlEncodedContent
System.UriFormatException: Invalid URI: The Uri string is too long.
问题是这一行:
FormUrlEncodedContent content = new FormUrlEncodedContent(postData);
在研究这个我已经学会这是因为大小限制的FormUrlEncodedContent。但我不知道我该如何解决这个问题?见代码如下:
public Token RequestToken(string username, int businessID, string requestXml)
{
var postData = new Dictionary<string, string>() { { "username", username }, { "businessID", businessID.ToString() }, { "authenticator", requestXml } };
FormUrlEncodedContent content = new FormUrlEncodedContent(postData);
try
{
HttpResponseMessage response = _client.PostAsync("Token", content).Result;
if (response.IsSuccessStatusCode)
{
return response.Content.ReadAsAsync<Token>().Result;
}
}
catch (Exception ex)
{
log.Error(ex);
}
return null;
}
任何人都可以帮忙吗?
看看[此帖](http://stackoverflow.com/questions/6695208/uri-escapedatastring-invalid- uri-the-uri-string-is-too-long/10755250#10755250) –
我对提供的链接中的示例有点困惑。那个例子是使用一个字符串,我有一本字典? – PixelPaul