I have a solution in Visual Studio 2012 that contains an azure project and an MVC web project among others. The web project is using Entity Framework Code First. The database is localdb. If I set the web project as the startup project, it runs fine locally. Code First changes are propagated to the database and the app runs fine when debugging. If I set the azure project as the startup project to run locally under the app fabric, I get the error below when logging into the application and hit the database for the first time. The app runs fine when deployed to azure. I can access the database locally through SQL Server Management Studio. The app can access the database fine when the web app is set as the startup project. I thought it might be database permissions, so I changed the connection string for localdb to not use a trusted connection and created a new login in the local database with sysadmin privileges. Same error.
Here is the connection string:
connectionString="Data Source=(localdb)\v11.0;Initial Catalog=[Database Name];User ID=[User Name];Password=[Password];Integrated Security=False; MultipleActiveResultSets=True;"
Here is the error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.