I have wirtten a RESTful WCF Service. Incorporating E-Tags, expires headers.
我有一个RESTful WCF服务。合并电子标签,过期标头。
The caching works great when using it from a browser. However how does the caching work when calling it from a WCF Channel Factory or .NET Web Request Objects?
从浏览器使用缓存时,缓存效果很好。但是,从WCF Channel Factory或.NET Web Request Objects调用缓存时,缓存是如何工作的?
So in the scenario where I have my website calling the WCF restful service when a 304 not modified response is returned to me. How do I handle this. The browser detects this fine and returns the unmodified version from its cache.
因此,在我的网站调用WCF restful服务的情况下,当304未修改的响应返回给我时。我该如何处理呢浏览器检测到这种情况并从其缓存中返回未修改的版本。
However when the client is not the browser do I need to write my own version of the cache similiar to the way the browser caches?
但是,当客户端不是浏览器时,我是否需要编写自己的缓存版本,类似于浏览器缓存的方式?
Any help or insight would be much appreciated.
任何帮助或见解将不胜感激。
2 个解决方案
#1
3
Yes, you're going to have to handle that yourself, same as that you're responsbile for sending the datetime in the request, so the server can determine if there was a change. I would look at the RSS Bandit source for a sample implementation.
是的,您将不得不自己处理,与您在请求中发送日期时间的责任相同,因此服务器可以确定是否有更改。我会看一下示例实现的RSS Bandit源代码。
#2
2
We have a sample that illustrates how to do this (using .NET 4) http://code.msdn.microsoft.com/cannonicalRESTEntity
我们有一个示例说明如何执行此操作(使用.NET 4)http://code.msdn.microsoft.com/cannonicalRESTEntity
#1
3
Yes, you're going to have to handle that yourself, same as that you're responsbile for sending the datetime in the request, so the server can determine if there was a change. I would look at the RSS Bandit source for a sample implementation.
是的,您将不得不自己处理,与您在请求中发送日期时间的责任相同,因此服务器可以确定是否有更改。我会看一下示例实现的RSS Bandit源代码。
#2
2
We have a sample that illustrates how to do this (using .NET 4) http://code.msdn.microsoft.com/cannonicalRESTEntity
我们有一个示例说明如何执行此操作(使用.NET 4)http://code.msdn.microsoft.com/cannonicalRESTEntity