[Mono-aspnet-list] mvc3 FileCacheProvider Serialize Error reporting
kevinokay
250588116 at qq.com
Fri Jan 11 05:09:36 UTC 2013
In mvc3,i use FileCacheProvider to cache page
FileCacheProvider Set code:
public override void Set(string key, object entry, DateTime
utcExpiry)
{
CacheItem item = new CacheItem(entry, utcExpiry);
string path = ConvertKeyToPath(key);
try
{
using (FileStream file = File.OpenWrite(path))
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(file, item );
}
}
catch (Exception E)
{
File.AppendAllText(HttpContext.Current.Server.MapPath("1og.txt"),
E.Message);
}
}
but catched report error
Type System.Web.Caching.CachedRawResponse is not marked as Serializable.
cacheitem code:
[Serializable]
public class CacheItem
{
public DateTime ExpiryDate;
public object Item;
public CacheItem(object entry, DateTime utcExpiry)
{
Item = entry;
ExpiryDate = utcExpiry;
}
}
I am running mono 2.10.8 complied from source on a CENTOS ..
Hope you can help..
Thanks
--
View this message in context: http://mono.1490590.n4.nabble.com/mvc3-FileCacheProvider-Serialize-Error-reporting-tp4658080.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.
More information about the Mono-aspnet-list
mailing list