I can\'t seem to figure out why I keep getting the following error:
Bytes to be written to the stream exceed the Content-Length bytes size specified.
There are three possible options
Fix the ContentLength as described in the answer from @rene
Don't set the ContentLength, the HttpWebRequest is buffering the data, and sets the ContentLength automatically
Set the SendChunked property to true, and don't set the ContentLength. The request is send chunk encoded to the webserver. (needs HTTP 1.1 and has to be supported by the webserver)
Code:
...
request.SendChunked = true;
using (Stream writeStream = request.GetRequestStream())
{ ... }