Type 'Microsoft.WindowsAzure.Storage.Table.CloudTable' is not marked as serializable RRS feed

  • Question

  • Hi,

    On my Azure Cloud Service web role, I want to use Redis Cache for session management. For that I have added following to my web.config

    <sessionState timeout="2000" mode="Custom" customProvider="MySessionStateStore"><providers>
    <add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" connectionString="jlmscloud.redis.cache.windows.net:6380,password=XXXXXXXXXXXXXXXX,ssl=True,abortConnect=False" />

    On my Login.aspx page, I have one my own object 'AuditLog' which stores log to Azure Table. 

    While I browse Login page with debug break point, all lines of code works well. But after last line of code it gives me following error,

    "Type 'AuditLog'  is not marked as serializable."

    Audit log object is not being stored to session state. Even though it gave me such error. While searching, I found that object being stored to session should be serilazable, but in my case I am not storing auditlog object to session even i am getting this error.

    To avoid this error I have added [Serializable] above class definition. 

    After doing that I have started getting below error. 

    Type 'Microsoft.WindowsAzure.Storage.Table.CloudTable' in Assembly 'Microsoft.WindowsAzure.Storage, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.

    In my auditlog class I am storing log text to Azure table. 

    While searching on internet I found that azure storage object is serializable after version 2.4. But I am using 7.0 version of Azure storage library which is latest. 

    I am surprised to see such error, as this code has nothing to do with session. 


    Wednesday, May 25, 2016 6:28 AM