Markissimo
Markissimo

Reputation: 329

Using static class on a WCF within a ASP.NET application

I've got an ASP.NET MVC application with a static class which I use to manage my cache objects, also I got a WCF within the same project which I use as a callback for another sources to call and update the same cache.

So, my problem is: suppose I do something on my webpage that sets my cache object to the value "A", now my WCF is invoked so the cache would be set to "B", both operations works, but each one appears to be at different sessions, if I debug an operation of the ASP.NET, then the cache's value is "A" even after my WCF has been called(which would make the variable goes to "B").

What is this behavior? I mean, is there like two sessions, one for the ASP.NET Application and another for the WCF?

Thanks!

Upvotes: 1

Views: 269

Answers (2)

Markissimo
Markissimo

Reputation: 329

So, I thought that I had it working before and I was right. The thing is, it doesn't work on the IIS Express that VS uses to debug! When I deployed on a full IIS it worked!

Thanks everyone that helped!

Upvotes: 0

Thiago Custodio
Thiago Custodio

Reputation: 18387

They run in different contexts. You should use a shared cache for both. ie redis cache.

Upvotes: 2

Related Questions