Reputation: 5793
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
Upvotes: 8
Views: 24170
Reputation: 1
Once check IIS , right click default web API and then advanced settings and check the physical path you have given is correct or not . Is it point to correct path.
Upvotes: 0
Reputation: 1142
I needed to keep <clear />
at the top of my connection strings for various reasons, and while the solution of adding a dummy connection string called LocalSqlServer
worked, I found it messy to keep it around for reasons of "I don't know why we need it, but app doesn't work without it".
My solution was to remove the roleManager
line below, since it was leftover from old code and wasn't required anymore.
<system.web>
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" />
</system.web>
Upvotes: 0
Reputation: 124766
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.
Upvotes: 33