REST file upload with HttpRequestMessage or Stream?

前端 未结 2 539
半阙折子戏
半阙折子戏 2020-12-31 09:05

What is the better way to upload a file for a REST client?

From the WCF Web API Documentation

[WebInvoke(UriTemplate = \"thumbnail\", Method = \"POST         


        
2条回答
  •  时光取名叫无心
    2020-12-31 09:22

    The first method is "closer to the metal" and would be more flexible since you would be processing the http requests and building the responses yourself. If all you need to do is accept a stream from a client, the second option is much simpler from the implementation standpoint (under the hood, it does the same work that the first method is doing)

    I don't have an answer for your last question.

提交回复
热议问题