Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty

So yesterday i installed PHP and MySQL on my development machine. Since then i get the following error when trying to run one of my .NET projects:

The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

It references this line of the Machine.Config:

<add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

I have searched online, high and low and can confirm that my machine.config HAS the necessary connection string:

  <connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="LocalMySqlServer" connectionString="" />

Interestingly enough, i performed the exact same operation of installing PHP and MySQL on my production server (server 2008) and there is no problem there. My dev machine is Windows 7.

My whole dev machine is broken because of this. How can i repair the machine.config or fix it and resolve this problem? Has anyone experienced this before?

Nugs

like image 940
Nugs Avatar asked Jun 11 '12 17:06

Nugs


1 Answers

Maybe there is a web.config somewhere that contains:

<connectionStrings>
    <clear/>
    ...
</connectionStrings>

You might also want to double-check that you're looking at the right machine.config. There are separate machine.configs for each Framework version, and also separate ones for the 32-bit and 64-bit framework.

like image 113
Joe Avatar answered Sep 28 '22 03:09

Joe