title: Web Site Administration Tool: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty
body: <p>I'm trying to use the Web Site Administration Tool to configure membership for a web site on my server. I've created an aspnetdb database on my local copy of SQL Server, and through the WSAT, I've managed to add several roles, and to lock down a couple of directories on the server. </p>
  
  <p>However, when I try to manage users, I get the following error:</p>
  
  <blockquote>
    <p>The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. at System.Web.Util.SecUtility.GetConnectionString(NameValueCollection config) at System.Web.Security.SqlMembershipProvider.Initialize(String name, NameValueCollection config) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)</p>
  </blockquote>
  
  <p>Clearly, the LocalSqlServer connection string <em>is</em> OK, otherwise I wouldn't have been able to add the roles, for example.</p>
  
  <p>The relevant parts of web.config are as follows:</p>
  
  <pre><code>  &lt;connectionStrings&gt;
          &lt;clear /&gt;
          &lt;remove name="LocalSqlServer"/&gt;
          &lt;add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;User Id=LoginUser;Password=password;" providerName="System.Data.SqlClient"/&gt;
    &lt;/connectionStrings&gt;
  
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.0" /&gt;
      &lt;authentication mode="Forms"&gt;
        &lt;forms loginUrl="~/Account/Login.aspx" timeout="2880" defaultUrl="~/admin/admin.aspx" /&gt;
      &lt;/authentication&gt;
          &lt;membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15"&gt;
              &lt;providers&gt;
                  &lt;clear /&gt;
                  &lt;add
            name="SqlProvider"
            type="System.Web.Security.SqlMembershipProvider"
            connectionStringName="LocalSqlServer"
            applicationName="myapp" /&gt;
              &lt;/providers&gt;
          &lt;/membership&gt;
      &lt;profile&gt;
        &lt;providers&gt;
          &lt;clear /&gt;
                  &lt;add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="myapp" /&gt;
        &lt;/providers&gt;
      &lt;/profile&gt;
      &lt;roleManager enabled="true"&gt;
        &lt;providers&gt;
          &lt;clear /&gt;
                  &lt;add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="myapp" /&gt;
        &lt;/providers&gt;
      &lt;/roleManager&gt;
    &lt;/system.web&gt;
  </code></pre>
  
  <p>As far I understand it, the Clear/Remove elements should override any other config files, but regardless, I tried adding the same connection string to the relevant machine.config, but to no avail.</p>
  
  <p>Any ideas?</p>
  
  <p>As an alternative, is there any reason why I can't call the Membership DB stored procedures directly? Does anyone know of any supporting documentation?</p>