2

I am looking for a way to create a HttpServer in C# that supports the chunked Transfer-Encoding for multipart-form posts. Reason is that I need to transfer large files (2-10GB) and the client application has to use the chunked transfer-encoding - else it runs out of memory when loading the file into memory. I have looked though the web and found quite a lot of examples that are using the System.Net.HttpListener class in .Net but I was not able to get that one to work with receiving data from a client that uses the chunked Transfer-Encoding.

Does anyone have an example of how to do that?

Any hint is greatly appreciated.

1
  • The docs seem to imply that setting the response.ContentLength64 property may result in chunked data. Some other fiddling might be necessary. Doc here Commented Sep 14, 2017 at 15:30

1 Answer 1

3

after trying more I wound the solution: You only need to set

httpWebRequest.SendChunked = true;
httpWebRequest.AllowWriteStreamBuffering = !Chunked;

That made it work for me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.