WCF Chunking / Streaming

后端 未结 4 1892
再見小時候
再見小時候 2021-01-31 12:03

I\'m using WCF and want to upload a large file from the client to the server. I have investigated and decided to follow the chunking approach outlined at http://msdn.microsoft.c

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 12:54

    This article explains how to use the MessageHeader attribute to force things to be passed in the header, and therefore not count as a parameter. So, instead of passing a stream and other meta data, create a class that has the attribute MessageContract and mark all of the meta data as a MessageHeader. Then, mark the stream as a MessageBodyMember (which the article incorrect calls "MessageBody"). Have your UploadStream method take a single parameter whose type is that of the MessageContract class you've just created. I've done this successfully, but I haven't done it in tandem with chunking. Good luck.

提交回复
热议问题