I was trying out making a website with asp.net to see how data binding works but when I launch the application, it throws this error.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
I checked the internet and I found a lot of possible solutions but none of them worked for me.
I created a custom database in the App_Data folder of the project and the connection stri开发者_如何转开发ng is
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True
It cannot locate the data file at the specified path, or the user does not have sufficient privileges to access the data file.
If the database is set up for Windows Authentication Mode, you should try changing your connection string to something like this:
Server=<COMPUTER NAME>\SQLEXPRESS;Database=<DATABASE NAME>;Trusted_Connection=True;
OR
Server=<COMPUTER NAME>\SQLEXPRESS;AttachDbFilename=<DIRECTORY PATH>\<FILE NAME>.mdf;Trusted_Connection=True;
精彩评论