WCF Cache vs. Page.Cache

I've got two different, but closely related ASP.Net web applications that use the same data on some pages. In both applications I am using the ObjectDataSource control, have EnableCaching="true", and use the same CacheKeyDependency value in both applications.

I would like to make it so that when a new record is inserted or deleted in one application, it clears the cache in both applications. I began by simply clearing cache by using Page.Cache, but soon realized that it does not clear the cache in the other application. Then I added a WCF service to each application; each service clears the cache object in the application it is hosted in. Except that it doesn't...

First, I discovered that System.Web.HttpContext is always null in WCF. Then I tried instantiating a System.Web.Routing.RequestContext object, but its HttpContext object is always null as well.

It all boils down to this: If I set a Page.Cache object, can a WCF service access that same cache object, if the service is hosted in the same application as the page?


Yes, you need to enable ASP.NET integration for the WCF service. This involves setting the aspNetCompatibilityEnabled attribute for the serviveHostingEnvironment element in config as well as adding the AspNetCompatibilityRequirementAttribute attribute to you service class to indicate that you support it.

More on this subject can be found here on MSDN.

Need Your Help

The BASEDIR environment variable is not defined correctly

linux tomcat

While running my tomcat the following error is coming .

How to configure Oracle WebCenter Portal Project so that I can add JavaScript files without having to restart the server?

javascript oracle-adf webcenter

Title pretty much says it all. Your help is greatly appreciated. I'm so happy that I just got the JavaScript to show up in the first place, now only if it actually updated when I changed it, I can