Quantcast
Viewing all articles
Browse latest Browse all 12963

Using SQL Azure for session state throws a cast error

I have a web application running on an Azure VM using SQL Azure for persistence. I just added a second SQL Azure database for ASPState. I believe that I have set up the ASPState database correctly but certain transaction cause aUnable to cast object of type 'System.DBNull' to type 'System.Byte[]'.

Here is the TempSessions table schema

CREATE

TABLE[dbo].[ASPStateTempSessions](


[SessionId]

NVARCHAR(88)   NOTNULL,


    [Created]         

DATETIME        DEFAULT(getutcdate())NOTNULL,


    [Expires]         

DATETIME        NOTNULL,


    [LockDate]        

DATETIME        NOTNULL,


    [LockDateLocal]   

DATETIME        NOTNULL,


    [LockCookie]      

INT             NOTNULL,


    [Timeout]         

INT             NOTNULL,


    [Locked]          

BIT             NOTNULL,


    [SessionItemShort]

VARBINARY(7000)NULL,


    [SessionItemLong] 

IMAGE           NULL,


    [Flags]           

INT             DEFAULT((0))NOTNULL,


   

PRIMARYKEYCLUSTERED([SessionId]ASC)

);


 


GO

CREATE

NONCLUSTEREDINDEX[Index_Expires]

   

ON[dbo].[ASPStateTempSessions]([Expires]ASC);



Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>