c# - .Net WebAPI not responding when returning HttpResponseMessage -


i'm having problem web api action when returning httpresponsemessage. object return stream of audio, file have 60kb , in first time have success when call web api, however, in next time web api not responds , browser stay loading.

below following code:

why web api not works/responds in next time call?

[httpget] [route("api/card/playaudio/{text}")] public async task<httpresponsemessage> playaudio(string text) {     var audiostream = await _cardservice.getstream(text);     return createaudioresponse(audiostream); }  private httpresponsemessage createaudioresponse(system.io.stream audiostream) {     var result = this.request.createresponse(httpstatuscode.ok);      //httpresponsemessage result = new httpresponsemessage(httpstatuscode.ok);     result.content = new streamcontent(audiostream);     result.content.headers.contentdisposition = new contentdispositionheadervalue("attachment");     result.content.headers.contentdisposition.filename = string.format("{0}.mp3", new guid().tostring());     result.content.headers.contenttype = new mediatypeheadervalue("application/octet-stream");     result.content.headers.contentlength = audiostream.length;     return result; } 


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -