asp.net mvc - Download a file from web api via mvc controller? -


i have published api route that's returning task. separate site i'm trying hit route, stream, , save contents file local system that's accessing site. test console application that's hitting route stream fine , can whatever want it. separate mvc controller, when stepping through, after hitting route , waiting result page appears stop. stepping through nothing after stepping on line. how around this?

sorry, forgot abstracted away lot of details may important.

the getstream method

return (new httpclient()).getstreamasync(route);  //where route route api method 

and method behind route has

            httpresponsemessage result = new httpresponsemessage(httpstatuscode.ok);             var stream = new filestream(path, filemode.open);             result.content = new streamcontent(stream);             result.content.headers.contenttype = new mediatypeheadervalue("application/octet-stream");             return result; 

the method in mvc controller

public fileresult downloadlogfile([bind(include = "selectedlogfile")] diagnosticsmodel diagnostics)     {         using (var downstream = getstream())         {             return new filestreamresult(downstream, system.net.mime.mediatypenames.application.octet);         }     }  private stream getstream() {     var apiresult = api.getstream();     return apiresult.result; } 


Comments