I'm having hard time deploying my website from my local machine to my VPS, here is the problem, I'm using AttachDBFileName in my web config in my local project and this is the ONLY connection string I have in my web application
<connectionStrings>
<add name="myConnectionString"
connectionString="Data Source=.\SQLEXPRESS;
AttachDBFileName=|DataDirectory|\AssignmentDB.mdf;
Integrated Security=True; User Instance=True;
Database=AssignmentDB.mdf" providerName="System.Data.SqlClient" />
This connection string lies in the web.config at the root of my web app.
And I deploy this by hand every time because I dont know how to use msdeploy, And here is what I've tried so far:
- 1- changing the connection string gizillion times and no luck..
- 2- attaching the db to my sql express on the VPS using SQL management studio and giving permissions to all logins.
- 3- restarting the website in iis after each change.
Every time I run the website and try to use any feature that requires a connection to the DB I get error 500.
The thing is, I've googled this problem and no one seems to suggest any clear configuration for all 3 applications involved to run this database.
Update:
this is the connection string I tried after attaching the DB to the sql server.
<add name="myConnectionString" connectionString="Data Source=.\SQLEXPRESS;
Initial Catalog=AssignmentDB; Integrated Security=True"
providerName="System.Data.SqlClient" />
I'm not getting any specific error message, it only redirects me to the error 500 page and that's all.
Update - 2
Just to clear it for future users, the default AppPool had its identity set to DefaultAppPoolIdentity, I changed that to localSystem and it gained access to my DB :)