filipw / Strathweb.CacheOutput

ASP.NET Web API CacheOutput - library to allow you to cache the output of ApiControllers
Other
883 stars 254 forks source link

Output caching of data from stream #48

Open mfigueiredo opened 10 years ago

mfigueiredo commented 10 years ago

Hello guys,

I've been using the Asp.Net OutputCache for caching Xml/Json return media type calls quite successfully. Great library!

I was also trying to cache web api calls that return a HttpResponseMessage for image or file contents. This is done by setting the HttpResponseMessage.Content property with a stream object. The web api call works great without OutputCache enabled, but as soon as I enable it, sooner or later the server gets stuck and the client waits for a while to receive a response, until it timeouts. While debugging on the server side, no error is thrown.

Does anyone know if this scenario should be working?

Thank you very much, Miguel

filipw commented 10 years ago

Can you try if the same happens with WebAPI2 version? http://www.nuget.org/packages/Strathweb.CacheOutput.WebApi2/ This obviously requires a Web API 2 project

On 31 October 2013 14:21, Miguel Figueiredo notifications@github.comwrote:

Hello guys,

I've been using the Asp.Net OutputCache for caching Xml/Json return media type calls quite successfully. Great library!

I was also trying to cache web api calls that return a HttpResponseMessage for image or file contents. This is done by setting the HttpResponseMessage.Content property with a stream object. The web api call works great without OutputCache enabled, but as soon as I enable it, sooner or later the server gets stuck and the client waits for a while to receive a response, until it timeouts. While debugging on the server side, no error is thrown.

Does anyone know if this scenario should be working?

Thank you very much, Miguel

— Reply to this email directly or view it on GitHubhttps://github.com/filipw/AspNetWebApi-OutputCache/issues/48 .

mfigueiredo commented 10 years ago

Hello Filip, thank you for the quick reply.

I'm currently using vstudio 2010 with MVC4 + v1 WebApi + v1 Strathweb.CacheOutput. That's where I was having the problem.

I've came up with a test web project in vstudio 2012, with web api 2.0 and Strathweb.CacheOutput.WebApi2. Came up with a web api controller and a service returning a HttpResponseMessage, similar to what was being done in my original environment. In this new environment the scenario works flawlessly.

Seems that the answer to my question is yes, but for Strathweb.CacheOutput.WebApi2. Is there a reason for this to not be working in v1? Or, will it be supported in v1?

Thank you very much, Miguel

filipw commented 10 years ago

There was a bug in v1 of CacheOutput that I suspect is related. I wanted to leave it, since I suspected most people would upgrade to WebAPi2 (and cacheoutput2) but I can release a fix this weekend and hopefully that helps.

cheers filip

On 31 October 2013 18:20, Miguel Figueiredo notifications@github.comwrote:

Hello Filip, thank you for the quick reply.

I'm currently using vstudio 2010 with MVC4 + v1 WebApi + v1 Strathweb.CacheOutput. That's where I was having the problem.

I've came up with a test web project in vstudio 2012, with web api 2.0 and Strathweb.CacheOutput.WebApi2. Came up with a web api controller and a service returning a HttpResponseMessage, similar to what was being done in my original environment. In this new environment the scenario works flawlessly.

Seems that the answer to my question is yes, but for Strathweb.CacheOutput.WebApi2. Is there a reason for this to not be working in v1? Or, will it be supported in v1?

Thank you very much, Miguel

— Reply to this email directly or view it on GitHubhttps://github.com/filipw/AspNetWebApi-OutputCache/issues/48#issuecomment-27500658 .

mfigueiredo commented 10 years ago

Hey Filip, I understand what you mean. Eventually I'll upgrade to vstudio 2012 and all of the great stuff that comes with it including, Web Api 2.0 and the work here. Means that for me it is good enough to known that this is working in Strathweb.CacheOutput.WebApi2.

If you happen to work on a fix for this later on, I'll check it out and return with some feedback. Thank you very much, Miguel