I have a web api controller method as follows:
[HttpPost]
public string PostMethod(int id)
{
Stream downloadStream = Service.downloadStream(id);
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
string output = jsonSerializer.Serialize(downloadStream);
}
I am calling this method from java applet with url as:
http://localhost1/api/PostMethod/1
I get an exception in line number 3 saying as:
"timeouts are not supported on this stream,The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'."
What could be the possible solution for this?How to send the stream through Webapi controller method as JSON object?