title: MVC 4 Connectionstring to SQL Server 2012
body: <p>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 get my connection string set correctly.</p>
  
  <p>My connection string from my Web.config:</p>
  
  <pre><code>  &lt;connectionStrings&gt;
      &lt;add name="ConnectionStringName"
          providerName="System.Data.SqlClient"
          connectionString="Data Source=MyServerName;
                            Initial Catalog=MyDatabaseName;
                            Integrated Security=False;
                            User ID=MyUserID;Password=MyPassword;
                            MultipleActiveResultSets=True" /&gt;
    &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Every time I go to ASP.NET Configuration from within Visual Studio, the page loads, but as soon as I click "Security" I get the following message:</p>
  
  <blockquote>
    <p>There is a problem with your selected data store. This can be caused
    by an invalid server name or credentials, or by insufficient
    permission. It can also be caused by the role manager feature not
    being enabled. Click the button below to be redirected to a page where
    you can choose a new data store. </p>
    
    <p>The following message may help in diagnosing the problem:  <strong>Unable to
    connect to SQL Server database.</strong></p>
  </blockquote>
  
  <p>I've verified that my credentials are correct (I can use them to connect via SQL Management Studio). Is there anything else I can check? I'm stumped.</p>
  
  <p><strong>UPDATE:</strong> </p>
  
  <p>I wasn't able to connect to my default instance from within SQL Management Studio (MSSQLSERVER) so I reinstalled SQL, creating a named instance (LHSQLSERVER). Now I'm able to connect to that instance in SQL Management Studio, but I'm still getting the same error from the ASP.NET Configuration.</p>
  
  <p>Another thing to note - the aspnet_regsql tool I ran was from the Framework64\v4.0.30319 folder. Is that correct if I am using .NET 4.5?</p>
  
  <p><strong>UPDATE 2:</strong> </p>
  
  <p>I've tried replacing my connection string with a connection string to a remote site (i.e. mysite.winhost.com) that I know works, but I'm still getting the same error in the ASP.NET Website Configuration Tool? FWIW I'm also using Windows 8, but I didn't think that would matter.</p>
  
  <p>Any thing else I can check?</p>
  
  <p><strong>UPDATE 3:</strong> </p>
  
  <p>I found <a href="https://stackoverflow.com/questions/11163547/mvc-4-rc-aspnet-regsql-exe">this post</a> that says you don't need the aspnet_regsql tool anymore for MVC 4, so I re-ran the tool removing all the settings, but again, no luck. Has anyone done this with MVC 4 before?</p>
  
  <p><strong>UPDATE 4:</strong></p>
  
  <p>See my answer below for the solution I found.</p>