I have figured out the solution
all we need to do here is to allow the compatibility of aspnet caching through adding the line in the web.config :
<servicehostingenvironment aspnetcompatibilityenabled="true" />
and in your data access layer, add the following line at the very top of your class like this :
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
so that the class looks like this :
using System.ServiceModel.Activation;
namespace WcfService2
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
public List<errorentities> GetALL()
{
List<errorentities> res = null;
if (CacheHelper.GetCache("GetALL")==null)
{
string cacheKey = "GetAll";
SqlCommand com = Global.GetCommand("select * from [BlockingList]");
com.Connection.Open();
SqlDataReader reader = com.ExecuteReader();
res = Fill(reader);
CacheHelper.Cache(cacheKey, res, 2);
com.Connection.Close();
return res;
}
else
{
res = CacheHelper.GetCache("GetALL") as List<errorentities>;
return res;
}
}
</errorentities></errorentities></errorentities>
as you noticed you must add
using System.ModelService.Activation;
so that the added service could work,,
hope this might save for anyone his valuable time, because i've been working on this problem for 3days with no hope to find any solution.