I\'ve created a brand new MVC 4 application in C# using Visual Studio 2012. I\'m trying to connect to a brand new SQL Server 2012 (Standard) instance but I can\'t seem to ge
You may need to enable the role manager in config
<roleManager enabled="true"/>
didn't try with SQL 2012 but this Connection string worked fine with SQL 2008 R2
connectionString="Server=ServerAddress;Database=DataBaseName;User Id=Username;Password=Password;"
or
connectionString="user id=UserName;password=Password;initial catalog=DatabaseName;data source=SQLServerIPorFQDN;Connect Timeout=30;"
Thanks everyone for the input, I have finally found a solution. I came across this article that describes the new Simple Membership that VS 2012 uses for MVC 4. I basically just started over, creating a new database, new MVC 4 project, and just followed the instructions in the article. Sure enough, just "registering" on the web page created the table(s) in my database and stored the user information.
If you are able to connect using Sql Management Studio then I believe there must be problem with Connection String -
Connection String You are using follows format -
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
User ID=myDomain\myUsername;Password=myPassword;
Try using IP Address, Port
in Data Source field like -
<connectionStrings>
<add name="ConnectionStringName"
providerName="System.Data.SqlClient"
connectionString="Data Source=190.190.200.100,1433;
Initial Catalog=MyDatabaseName;
Integrated Security=False;
User ID=MyUserID;Password=MyPassword;
MultipleActiveResultSets=True" />
</connectionStrings>
OR try other variations -
Standard Security
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Trusted Connection
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Connection to a SQL Server instance
Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;
Reference - http://www.connectionstrings.com/sql-server-2012
While lhan16's answer helped me, it would have been simpler to say that all you needed to add was a DefaultConnection. I started from the same place, and the database connection that the MVC uses doesn't work for the security framework. The authors of the framework never imagined that you would not use the DefaultConnection.