nikivancic
nikivancic

Reputation: 188

Running ASP.NET app with VS2012 debugger uses LocalDB despite connection string in web.config

I want to use SQL 2008 R2 on the server where I run VS 2012, so I created the "membership" database (using Aspnet_regsql tool) and configured it to work with IIS7). Then I created ASP.NET Application and modified the web.config so that connection string points to this database.

Running this app with VS 2012 debugger results with my app creating the LocalDB ASPNETDB.MDF instance in app_data folder. VS ASP.NET Configuration tool when invoked from VS Tools menu shows the LocalDB based data and the running application access this database instead of SQL Server 2008 R2 server - which runs on the same server.

I believe that this is some side-effect of the VS generated web.config file, but despite looking hard, I found nothing suspicious.

Note: this same scenario works just fine with Visual Studio 2010 if I am using it's own generated web.config file.

I would hate to dismiss VS 2012 for this as I am pretty sure that I did something wrong.

Upvotes: 1

Views: 470

Answers (1)

Charlie
Charlie

Reputation: 11

I had the same problem as this and needed to change more than just the connection string. I was targeting .NET 4.0 framework not 4.5, not sure how much difference this makes. I had a look on MSDN http://msdn.microsoft.com/en-us/library/6e9y4s5t(v=vs.100).aspx

You need to change not just the connection string but also the membership defaultProvider so that it is a SqlProvider

Upvotes: 1

Related Questions