views:

759

answers:

4

I have an ASP.NET app that accesses a SQL Server database with membership and roles tables included. The app works perfectly when run locally, but when I deploy it to a shared Godaddy host, write operations on the database seem to act funny. I added before my connection strings in web.config to see if the app was trying to access a different database, and I got the following error in machine.config (which I have no control over since it is a shared host):

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

Any ideas about what might be causing this to happen? Thanks in advance.

  • Jared
A: 

Add this before you add your own connection string to your web.config:

<clear />
mxmissile
A: 

This is because you are referencing LocalSqlServer somewhere. You must have this in YOUR machine.config. That is why it doesn't complain on your PC. This is usually because your Membership or Role section in your web.config references a provider which then in turn references a connection string. And the default connection string name is "LocalSqlServer". So you should comment out this connection in your machine.config to troubleshoot. Also clear all the providers in your web.config.

<membership defaultProvider="MyOnlyMembershipProvider">
     <providers>
        <clear/>
           <add name="MyOnlyMembershipProvider" 
               connectionStringName="NotLocalSqlServer"
               ...
     </providers>
</membership>
JBrooks
Yeah the <clear /> before the providers was the key. Thanks.
Jared
A: 

mxmissile, thanks a lot for your post. Adding inside solved this issue for me.

Nishanth Nair
A: 

I had the same problem but this answer solved it. That was perfect thank a lot.

hessam