Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model

Post by Shalex » Tue 26 Mar 2013 18:10

Basing on your post (http://forums.devart.com/viewtopic.php? ... 248#p89340), the problem with MSDeploy is solved, isn't it?

acooper
Posts: 19
Joined: Mon 04 Feb 2013 15:51

Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model

Post by acooper » Thu 28 Mar 2013 13:06

I now have everything working and deployed to a server. I believe that the biggest problem I had was an incorrect connection string. This one worked for me:
<add name="DefaultConnection" connectionString="Data Source=|DataDirectory|\DevartMembership.db" providerName="Devart.Data.SQLite" />

Remember that if you change the name “DefaultConnection” that you also have to change it in the context in the AcountModels.cs in the Models folder.
If you create a new connection string to the membership database and leave the DefaultConnection string in the Web.config and use the new string in the controller (thinking you’ve replaced the old DefaultConnection because you’re not using it) everthing will work until you deploy it to the server!

THIS IS BAD it works but will fail on deploy:

<add name="DevartConnection" connectionString="Data Source=|DataDirectory|\DevartMembership.db" />
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-SqlQueryTest-20130307123920;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-SqlQueryTest-20130307123920.mdf" providerName=" Devart.Data.SQLite " />

Also these connection strings don’t work!

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-SqlQueryTest-20130307123920;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\ DevartMembership.db " providerName=" Devart.Data.SQLite " />

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\ DevartMembership.db " providerName=" Devart.Data.SQLite " />

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDBFilename=|DataDirectory|\ DevartMembership.db " providerName=" Devart.Data.SQLite " />

Post Reply