Can't resolve "LocalSqlServer was not found in the application" error

Discussion in 'ASP.NET / ASP.NET Core' started by Datatron, Jun 15, 2015.

  1. I updated one of my subdirectories which is written in C# on my remote server and when I bring up the webpage of the updated directory on my remote server and try to access my database, I get the infamous "LocalSqlServer' was not found in the applications configuration". I have researched other answers to this problem on the internet and have yet to find a solution. I do not have this problem running on my local server.

    My machine.config file in the Windows directory has the following entry for LocalSqlServer:

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

    Below is what I added to my web.config file for the updated subdirectory replacing the xxxxxxxxx with the specs for my database on the remote server.

    <connectionStrings><clear /><remove name="LocalSqlServer"/><add name="LocalSqlServer" connectionString="Server=xxxxxxxxxxxxx; User xxxxxxxxxxxxxr;password=xxxxxxxxxx;Database=xxxxxxxxxx;Persist Security Info=False" providerName="System.Data.SqlClient"/></connectionStrings>

    This didn't work so I entered this:

    <connectionStrings><clear /></connectionStrings>

    This didn't work either for I removed the connectionStrings entry entirely and that didn't work either. This subdirectory used to work until I upgraded to NetFramwork 4.0. What is confusing is that I have several other subdirectories that run fine on this server and they do not reference connectionStrings at all in their web.config file. So why doesn't this subdirectory have this problem? I have been running this website for 14 years and this is the first time I encountered this problem. So something changed somewhere. Any help will really be appreciated.
     
  2. FrankC

    FrankC DiscountASP.NET Staff

    what is the exact error?

    you can also open a support ticket if you do not want to post details to the forum
     
    mjp likes this.
  3. The error was "LocalSqlServer' was not found in the applications configuration". However, I solved the problem. I was entering a URL address that was incorrect. The webpage existed in 2 different directories and I entered the webpage address for the wrong directory and that is what caused the error because it was executing the wrong page. However, the error is so meaningless that I couldn't figure out what was wrong. Once I entered the correct directory in the URL, the problem went away. But thanks for your attempt to help.
    Dave
     
    mjp likes this.

Share This Page