Is it possible to store session state in SQL Server CE? I was finding any posts about it and didn't get any examples. I develop an asp.net mvc 4 application.
But I want to use SQL Server CE edition, and that means only using local files, there is no url for Sql Server instance. I decided to implement my own SessionStateProvider which should work with SQL Server CE. I have implemented membership and roles
providers and they worked fine. One more remains
Yep, I've tried to go by this method, but it doesn't work for me. The error:
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
I used Universal Provides for Sql Server CE, and everything works fine except for the session storing in SqlServer mode. So I decided to implement my own session-state store provider which would work with Sql Ce throughout the Entity Framework. it
works perfectly
Link to msdn about the realization of the provider: http://msdn.microsoft.com/en-us/library/ms178587(v=vs.100).aspx
karyazhkin
0 Points
3 Posts
SQL Server Compact and Session State
Nov 16, 2012 06:18 AM|LINK
Is it possible to store session state in SQL Server CE? I was finding any posts about it and didn't get any examples. I develop an asp.net mvc 4 application.
dhol.gaurav
Contributor
3998 Points
725 Posts
Re: SQL Server Compact and Session State
Nov 17, 2012 11:29 AM|LINK
Check following link it may help you
http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx
let me know if any query
Gaurav Dhol
Skype ID : dhol.gaurav
If My Post contains helped you, Please Mark as Answer
karyazhkin
0 Points
3 Posts
Re: SQL Server Compact and Session State
Nov 18, 2012 03:39 PM|LINK
<sessionState mode="SQLServer" sqlConnectionString="???" customProvider="DefaultConnection">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="WeddingStoreDbConnectionString" />
</providers>
</sessionState>
But I want to use SQL Server CE edition, and that means only using local files, there is no url for Sql Server instance. I decided to implement my own SessionStateProvider which should work with SQL Server CE. I have implemented membership and roles providers and they worked fine. One more remains
Mark - MSFT
Contributor
7071 Points
435 Posts
Microsoft
Re: SQL Server Compact and Session State
Nov 20, 2012 07:05 AM|LINK
Hi karyazhkin,
Your sqlConnectionString should be "Data Source=|DataDirectory|\Database.sdf"
refer:
http://msdn.microsoft.com/en-us/library/ms174053.aspx
Best Regards
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
karyazhkin
0 Points
3 Posts
Re: SQL Server Compact and Session State
Nov 20, 2012 09:31 AM|LINK
Yep, I've tried to go by this method, but it doesn't work for me. The error:
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
I used Universal Provides for Sql Server CE, and everything works fine except for the session storing in SqlServer mode. So I decided to implement my own session-state store provider which would work with Sql Ce throughout the Entity Framework. it works perfectly
Link to msdn about the realization of the provider: http://msdn.microsoft.com/en-us/library/ms178587(v=vs.100).aspx
Shailendra S...
Member
551 Points
145 Posts
Re: SQL Server Compact and Session State
Nov 21, 2012 10:21 AM|LINK
Sql Server Compact has its own limitations i do not think it is advisable to sotre session state in sql server ce.
www.techaray.com