I am trying to deploy an MVC5 Website to an IIS7 Server. The Website uses an Asp.net Membership.
When trying to connect to my SQlServer, the Website is trying to use the machine.config connectionstring "LocalSqlServer".
But I did not specify to use this ConnectionString. How do I change this behaviour, so it uses the given connectionString in the web.config instead of the machine.cofnig.
public ApplicationDbContext()
: base("XXXXMembership", throwIfV1Schema: false)
{
}
Web.Config :
<connectionStrings>
<add name="XXXXMembership" connectionString="Data Source=xxxxxxxx;Initial Catalog=xxxxx;user id=xxxxx;password=xxxx;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
Add this to the top of your <connectionStrings>
section
<connectionStrings>
<clear />
<remove name="LocalSqlServer" />
<add name="XXXXMembership" connectionString="Data Source=xxxxxxxx;Initial Catalog=xxxxx;user id=xxxxx;password=xxxx;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>