2

I downloaded an ASP.NET MVC template onto my development machine a dropped it into the projects folder in my user profile (C:\Users\jdana\projects\gld_ember_mvcspa). An .MDF and .LDF file came along for the ride with the template. They're located here:

C:\Users\jdana\projects\gld_ember_mvcspa\App_Data

For the life of me, I can't get SQL Server Management Studio to read from or attach to any .MDF file in my user profile (I'm running SQL Server 2014 Standard on a Windows 7 box)

Here's what I've tried thus far.

  • The following Access is denied when attaching a database looked like a dead-match to my issue. I've given my local login account explicit full permissions to the projects folder and all child folders (making sure to logout/login afterwards).

  • I gave my local login account ownership of the projects folder and all child folders (making sure to logout/login afterwards).

  • I checked login associated with the MSSSQLSERVER Windows service, it's NT Service\MSSQLSERVER. I gave this login full permissions to the project folder (making sure to logout/login afterwards).

  • Finally, I launched SQL Server Management Studio with a right-click Run As Administrator.

None of this worked. My user profile folder remains inaccessible to SQL Server Management Studio.

Community
  • 1
  • 1
jdana
  • 31
  • 4
  • Attaching from a special folder like AppData is probably not a good idea. Aside from permissions, it might need to be un-hidden/system. Or any of the 3 following ideas may work - I don't know how well you searched. Try these: http://stackoverflow.com/questions/11603651 http://forums.asp.net/t/1904992.aspx?Can+i+include+SQL+SERVER+database+in+app_data+folder+on+production+with+SQL+SERVER+Entertprise+edition https://social.technet.microsoft.com/Forums/sqlserver/en-US/a9fbb849-71a7-4f42-affb-aaae94733604/cant-attach-my-project-database-mdf-file-using-sql-server-management-studio-r2?forum=sqltools – underscore_d Jul 14 '15 at 20:09
  • Yeah, the overwhelming feedback I get is move copies of the MDF/LDF files to a directory that MSSQL likes (like C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA), attach using Management Studio, then reconfigure the attachment in the .NET app. – jdana Jul 15 '15 at 15:33
  • Yup, there are so many variables at play with each of AppData and MSSQL, so that's probably much easier. Let us know what you find either way! – underscore_d Jul 15 '15 at 16:17

2 Answers2

1

I was faced with the same error when i changed the password to my SQL server account. The way out was to check if the files in the location you try to attach from are encrypted. Decrypt them(Right click on the mdf/ ldf file -> Decrypt). Then try attaching. This worked for me. Thanks to the helpdesk guy in my office:)

JC13
  • 11
  • 4
0

Run Sql Server Management studio as Administrator, and login to sql server with sa or admin credential. If mdf file is uncorrupt, then it will work.

user3838082
  • 159
  • 1
  • 5