4

I recently just started learning .NET, and more specifically I've been playing around with the MVC framework quite a bit and loving it. I'm running into a bit of a frustrating problem though. I can't add a database to my App_Data folder.

I'm running SQL Server 2008 R2 on my machine. When I go to add a new database to the App_Data folder I get a message "Connections to SQL Server database files (.mdf) require SQL Server 2008 Express to be installed and running. I did a little poking around and found this blog post describing how to set up a regular SQL Server database with mvc3. (http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/ASPNET/setting-up-sql-server-with-asp-net-mvc)

That works just fine, but after I do that when I try to add the newly created database to the App_Data folder I simply get an "Access is denied." error. I'm the admin on my machine and I can access the database just fine using SQL Server Management Studio.

Anyone know what I'm doing wrong?

1 Answer 1

6

The App_Data folder is only meant to be used with SQL Express, where it attaches the database "on-the-fly" using a feature called user-instance mode (see Connecting to SQL Server Express User Instances (ADO.NET)). I'm not exactly sure what you mean by "when I try to add the newly created database to the App_Data folder", but don't do that. Your database is being stored in SQL Server; there's no reason to try to put it inside your project.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.