title: Web API and ASP.Net Identity with SQL Server and not LocalDB
body: <ol>
  <li><p>How to set ASP.Net Identity to use SQL Server database and not LocalDB?</p></li>
  <li><p>How to customize ASP.Net Identity to use a custom data layer?</p></li>
  </ol>
  
  <p>Using Microsoft.AspNet.Identity.Core 1.0.0 and EntityFramework 6.0.0 in Web API .Net 4.5 </p>
  
  <p>Web.config changes:</p>
  
  <pre><code>&lt;connectionStrings&gt;
  &lt;add name="myAppDB"
       connectionString="data source=.;Initial Catalog=mydb1;Integrated Security=SSPI;"
       providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Error when calling api/account/register</p>
  
  <pre><code>{"Message":"An error has occurred.","ExceptionMessage":"An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.","ExceptionType":"System.Data.Entity.Core.ProviderIncompatibleException","StackTrace":"   at System.Web.Http.ApiController.&lt;InvokeActionWithExceptionFilters&gt;d__1.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerSeres.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__0.MoveNext()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"The provider did not return a ProviderManifestToken string.","ExceptionType":"System.Data.Entity.Core.ProviderIncompatibleException","StackTrace":"   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
     at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"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.
  )","ExceptionType":"System.Data.SqlClient.SqlException","StackTrace":"   .....
  </code></pre>
  
  <p>And Windows Application event log</p>
  
  <pre><code>Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
  </code></pre>