c# - REST API Put large data -


i have rest api implemented in microsoft web api.
in client use httprequestmessage , httpresponsemessage.
when sending small class, serialize json , send it.
soon, class becomes bigger, , need json class, zip (in memory) , send server. can no longer use same technique, need send zip in chunks.

what proper way achieve ? have read post posting file , associated data restful webservice preferably json

need articles, dont know start.

on client side should work pretty out of box...

        var httpclient = new httpclient();          httpclient.defaultrequestheaders.transferencodingchunked = true;          var content = new compressedcontent(new streamcontent(new filestream("c:\\big-json-file.json",filemode.open)),"utf8");          var response = httpclient.postasync("http://example.org/", content).result; 

you can find implementation of compressedcontent in webapicontrib. if using earlier .net 4.5 request buffered client side before sending. unfortunately underlying httpwebrequest doesn't support buffered streaming until .net 4.5


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -