line 160 error when accessing website

Discussion in 'General troubleshooting' started by lakeweather, Jun 7, 2010.

  1. I get the following error when trying to access my website Server Error in '/BCWS' 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 158: <roleManager>
    Line 159: <providers>
    Line 160: <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    Line 161: <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    Line 162: </providers>


    Source File: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 160


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016

    I have carefully folllowed the directions in the instruction:
    How to configure the ASP.NET 2.0 Membership/Roles Provider to use SQL 2000, SQL 2005 or SQL 2008

    I entered the following in the Appsettings section of web.config:
    <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=mssq104.discountasp.net;Integrated Security=false;Initial Catalog=DB_56091;
    User ID=myIDr;Password=my password" providerName="System.Data.SqlClient" />
    </connectionStrings>

    I do not understand the code providerName="System.Data.SqlClient
    Am I supposed to replace the name and if so with what.

    Cut me some slack on stupid errors, guys. I am a rank beginner.
     
  2. ...Apparently you don't have to use the providerName, according to one of the DASP staff but I never got a confirmation on that.
    I do always use it however, without the Integrated Security section.

    Try it like this, notice I'm adding a "clear", which clears out the previous instance of LocalSqlServer.

    <connectionStrings>
    <clear />
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=tcp:mssq104.discountasp.net;Initial Catalog=DB_56091;User ID=myIDr;Password=password"
    providerName="System.Data.SqlClient" />
    </connectionStrings>

    All the best,
    Mark
     
  3. Thanks Mark. I get the same error message with the clear. Does the order in which the code is arranged in the Appsettings section matter/ Or should the connection string go in annother section?
    Lilburn
     
  4. Hi,
    The main sections are in this order:

    <configuration>
    <configSections>
    <system.net>
    <system.web.extensions>
    <connectionStrings>
    <system.webServer>

    ...If you're using Visual Studio it can help to create a new blank Web site.
    Then create a test page to populate the new web.config with your conn settings.

    At that point it becomes a lot easier to compare the sections and order. Just a tip.
    All the best,
    Mark
     

Share This Page