1
I have a WINDOWS FORM C#application, where I communicate with a web service, when I try to send a very big data from my application to the web service I get error 500.
I can do a POST on any other object in JSON, but when it is this that contains very large data it gives way, the interesting fact is that if I try to get, I can recover this data for my application, I just can’t send to the server.
The big data are: a photo converted to Base64 and a binary file that is also converted to Base64.
Follow the code I post:
public void POST(string url, string jsonContent)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
Byte[] byteArray = encoding.GetBytes(jsonContent);
request.ContentLength = byteArray.Length;
request.ContentType = @"application/json";
using (Stream dataStream = request.GetRequestStream())
{
dataStream.Write(byteArray, 0, byteArray.Length);
}
long length = 0;
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
length = response.ContentLength;
}
}
catch (WebException ex)
{
// Log exception and throw as for GET example above
}
}
This method works cool with smaller json’s.
Who there has a notion of how I can solve this my problem?
If I use Finder for example or POSTMAN , with the same JSON I Gero , it accepts , but especially my application when I try to send this object I get exception ,
– Joab