0

we are developing an mobile application and we have used WCF service to fetch SQL Server data through online.

We are trying to authenticate each WCF Service call(server) by passing headers from client (mobile application). For this we have generated a token and passed the same in headers of each client call.

We have stored the tokens in HttpRuntime.Cache. But after few minutes [in idle mode] the cache entry is cleared.

Note: If continuously server and client communicates, it works perfectly.

Below is our WCF service Cache code:

HttpRuntime.Cache.Insert(key, Token, null, DateTime.Now.AddHours(1),Cache.NoSlidingExpiration);

if some other better solution available, kindly suggest how we can save the tokens alone in server and authenticate the same from client for each service call.

Kathir
  • 137
  • 3
  • 19
  • I think your issue is "AppDomain Recycles". Like you said it happens when there's a period of no use. Based on configuration, IIS/ASP.Net will shut down AppDomains which are 'unused/idle' (thereby killing the in memory cache). – Marvin Smit May 02 '14 at 11:04
  • Thanks for the quick response. Kindly suggest how to resolve the issue. – Kathir May 02 '14 at 11:12
  • Change recycle times? use 'out of process' or 'persistent' cache instead of in-memory cache? etc. – Marvin Smit May 02 '14 at 11:13
  • Kindly advice on how to change recycle times or kindly provide links for using 'out of process,Persistent' cache.? – Kathir May 05 '14 at 06:53
  • If you are using .Net4+ try using System.Runtime.Caching instead. – Paul Zahra Aug 14 '14 at 14:02

0 Answers0