Caching usable in both WCF and ASP .NET applications (.NET 3.5)

爷,独闯天下 提交于 2020-01-04 04:29:22

问题


I need caching facility which should work from both WCF and from within an ASP .NET app. I have seen:

  1. System.Web.Caching.Cache which is not usable from WCF (as I understand it is usable only if service is hosted in IIS, which is not always the case)

  2. System.Runtime.Caching which is usable from both of them, but only available from .NET 4, but our .NET version is 3.5.

Any suggestions?


回答1:


You can absolutely use System.Web.Caching.Cache outside of IIS. Just add a reference to System.Web and away you go - it is absolutely not a feature of IIS.

There were issues in .NET 1.0 and 1.1 but apparently not in 2.0 and upwards - see this Knowledge Base article.

But like Davide Piras I would also recommend considering AppFabric to share the cache between your two applications, if that would be useful. I'm not sure what you mean by "my requirement cannot afford something like AppFabric" - by "afford" are you talking about performance, memory, or what? Whilst AppFabric is designed to be used on a cache server it does not by any means require dedicated hardware, you can run the service on the same box as your application if you need to.




回答2:


new solution use Windows Server AppFabric Caching

http://cgeers.com/2010/07/04/windows-server-appfabric-caching/

http://dotnet.dzone.com/articles/caching-wcf-services-part-2

http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/AAP314

***2.in .NET 1.0 and 1.1 http://support.microsoft.com/kb/917411



来源:https://stackoverflow.com/questions/11686728/caching-usable-in-both-wcf-and-asp-net-applications-net-3-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!