title: How to fix the "The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty." error?
body: <p>I have an ASP.NET project using SQL Server CE 4.0 with Entity Framework 4.0. It works fine on my local computer.</p>
  
  <p>When I move it to the remote server, however, and try to log in to the admin part of the program, I get the following error:</p>
  
  <pre><code>The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
  </code></pre>
  
  <p>It references the following line in the machine.config on the remote server:</p>
  
  <pre><code>Line 237:    &lt;membership&gt;
  Line 238:      &lt;providers&gt;
  Line 239:        &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /&gt;
  Line 240:      &lt;/providers&gt;
  Line 241:    &lt;/membership&gt;
  </code></pre>
  
  <p>Now, it's true I don't have an "AspNetSqlMembershipProvider" statement in my web.config that references a connection string called "LocalSqlServer". Instead I have the following:</p>
  
  <pre><code>&lt;membership defaultProvider="DefaultMembershipProvider"&gt;
    &lt;providers&gt;
      &lt;add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider" connectionStringName="PUGConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" applicationName="/" /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  </code></pre>
  
  <p>This actually works locally. The name of the connection string is PUGConnection, not LocalSqlServer. </p>
  
  <p>Why would this work locally, and not remotely? (The remote server is a shared server -- I don't have access to the machine.config.)</p>
  
  <p>If I change the name of the connection string to LocalSqlServer, will it work? And if so, why would it work the other way on my local computer? The machine.config on my local computer looks the same as the one on the remote server, as far as I can tell.</p>