I'm having a BIG problem, this is my 3rd day looking for answer !
I'm trying to create a custom membership provider with MS SQL database 2005 but not the default ASPNETDB.
I've changed the web.config to be as following:
But when I try to login to the site using the login control the following error occurs:
Server Error in '/etest' Application.
Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
Source Error:
Line 149: <roleManager>
Line 150: <providers>
Line 151: <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 152: <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 153: </providers>
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.213
It is clear that this is a prblem with my Machine.Config file - since I've "worked!" on this file for a while. But when I've checked the Machine.config file I've found the LocalSqlServer
connection it is talking about! [:S] .
add
name="Odbc Data Provider"
invariant="System.Data.Odbc"
description=".Net Framework Data Provider for Odbc"
type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
<add
name="OleDb Data Provider"
invariant="System.Data.OleDb"
description=".Net Framework Data Provider for OleDb"
type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
<
add
name="OracleClient Data Provider"
invariant="System.Data.OracleClient"
description=".Net Framework Data Provider for Oracle"
type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
<add
name="SqlClient Data Provider"
invariant="System.Data.SqlClient"
description=".Net Framework Data Provider for SqlServer"
type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
<
add
name="SQL Server CE Data Provider"
invariant="Microsoft.SqlServerCe.Client"
description=".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition"
type="Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
In fact the page I found from Microsoft, the latter of the two links above, gives you the answer your looking for.
<roleManager enabled="true" />
"This configuration enables role management and causes your application to use the default provider named AspNetSqlRoleProvider defined in the Machine.config file. This uses the local SQL Express instance.
To
use a role store in SQL Server, add a connection string to point to
your role database and add a role provider definition in the Web.config
file, as shown here."
Also note that if you <clear/> your connection strings but don't <clear/> your Membership and Role providers, you will get the same error. This took us awhile to figure out!
Trying to accomplish the same thing..pulling what's left of my hair out..was going to try to get membership etc to work with SQLServer Express but ideally would like to create all : membership, provider, roles in Oracle. Did you just override within the
web.config or modify at the machine.config
level? Can anyone help..the msdn help just ain't doin it...Thanks
Member
55 Points
89 Posts
Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration or t...
Sep 27, 2007 04:24 AM|jocker_wow|LINK
Hi,
I'm having a BIG problem, this is my 3rd day looking for answer !
<connectionStrings>I'm trying to create a custom membership provider with MS SQL database 2005 but not the default ASPNETDB.
I've changed the web.config to be as following:
<add name="sqlConn" connectionString="Data Source=.;Integrated Security=True;Initial Catalog=ASPNETDB;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<
system.web><trace enabled="true" />
<roleManager enabled="true" />
<authentication mode="Forms" />
<
membership defaultProvider="MySqlProvider"><providers>
<remove name="AspNetSqlProvider"/>
<add name="MySqlProvider" connectionStringName="SqlConn"
type="System.Web.Security.SqlMembershipProvider" applicationName="/" />
</providers>
</membership>
But when I try to login to the site using the login control the following error occurs:
Server Error in '/etest' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
Source Error:
Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 151
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.213
It is clear that this is a prblem with my Machine.Config file - since I've "worked!" on this file for a while. But when I've checked the Machine.config file I've found the LocalSqlServer connection it is talking about! [:S] .
I'm lost and I dunno what to do, can anyone help?
Here is the mahine.config in case if you need it:
<connectionStrings><
add name="LocalSqlServer" connectionString="data source=.;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings><
system.data> <DbProviderFactories><
add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /><
add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /><
add name="SQL Server CE Data Provider" invariant="Microsoft.SqlServerCe.Client" description=".NET Framework Data Provider for Microsoft SQL Server 2005 Mobile Edition" type="Microsoft.SqlServerCe.Client.SqlCeClientFactory, Microsoft.SqlServerCe.Client, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> </DbProviderFactories></
system.data> <system.web><
processModel autoConfig="true" /> <httpHandlers /><
membership> <providers><
add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> </providers></
membership> <profile><
providers> <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /></
providers> </profile><
roleManager> <providers><
add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /></
providers> </roleManager></
system.web>web.config membership connection string aspnetdb app.config machine.config custom membership provider LocalSqlServer
M.Nagieb
Sr. Web Developer
Member
80 Points
43 Posts
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
Sep 27, 2007 12:13 PM|k2schreck|LINK
Jocker, there are plenty of sources on the internet to help. Check out:
4GuysFromRolla.com
msdn.microsoft.com
In fact the page I found from Microsoft, the latter of the two links above, gives you the answer your looking for.
"This configuration enables role management and causes your application to use the default provider named AspNetSqlRoleProvider defined in the Machine.config file. This uses the local SQL Express instance.To use a role store in SQL Server, add a connection string to point to your role database and add a role provider definition in the Web.config file, as shown here."
Kurt
Member
55 Points
89 Posts
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
Nov 07, 2007 06:43 AM|jocker_wow|LINK
k2schreck,
I've found the solution. Thanks for your reply! [:)]
M.Nagieb
Sr. Web Developer
Member
87 Points
174 Posts
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
Sep 09, 2009 07:15 AM|leeward30|LINK
Can you post the soultion please ?
Kered
None
0 Points
1 Post
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
Feb 12, 2010 11:37 AM|prateekgoel123|LINK
Just add <clear/> tags in providers in Membership & Role like following....... (Problem Solved)...
<membership defaultProvider="wmiMemProvider">
<providers>
<clear/>
<add connectionStringName="wmiDbConnectionString" e..........................eb.Security.SqlMembershipProvider"/>
</providers>
</membership>
<roleManager enabled="true" cookieName=".wmiRoles" cookieTimeout="60"
defaultProvider="wmiRoleProvider">
<providers>
<clear/>
<add connectionStringName="w.....................dowsTokenRoleProvider" />
</providers>
</roleManager>
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><membership defaultProvider="wmiMemProvider"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <providers></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <clear/></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <add connectionStringName="wmiDbConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="wmi" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="wmiMemProvider" type="System.Web.Security.SqlMembershipProvider"/></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </providers></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </membership></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <roleManager enabled="true" cookieName=".wmiRoles" cookieTimeout="60"</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> defaultProvider="wmiRoleProvider"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <providers></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <clear/></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <add connectionStringName="wmiDbConnectionString" applicationName="wmi"</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> name="wmiRoleProvider" type="System.Web.Security.SqlRoleProvider" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <add applicationName="wmi" name="wmiTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </providers></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </roleManager></div>None
0 Points
3 Posts
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
May 25, 2011 11:36 AM|BethW|LINK
Also note that if you <clear/> your connection strings but don't <clear/> your Membership and Role providers, you will get the same error. This took us awhile to figure out!
None
0 Points
1 Post
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
Oct 07, 2011 10:05 AM|Ears2Hear|LINK
Trying to accomplish the same thing..pulling what's left of my hair out..was going to try to get membership etc to work with SQLServer Express but ideally would like to create all : membership, provider, roles in Oracle. Did you just override within the web.config or modify at the machine.config
level? Can anyone help..the msdn help just ain't doin it...Thanks
Member
102 Points
38 Posts
Re: Urgent, The connection name 'LocalSqlServer' was not found in the applications configuration...
Feb 27, 2014 01:31 AM|Ankur56600|LINK
Nothing to do just Simply Add
<add name="LocalSqlServer" connectionString="Data Source=YourServerName;Integrated Security=true;Initial Catalog=YourDataBaseName" providerName="System.Data.SqlClient" />
this section in your webConfig file under <ConnectionString> Tag
ankur.jain.1989@gmail.com
"please don't forget to mark as Answer if it helps!!", Thank You