Very ugent: web.config file error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hi,

I get the following error when I try to go to the website home page.

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


Line 147:    <roleManager>
Line 148:      <providers>
Line 149:        <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 150:        <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 151:      </providers>

please help me, I need to see the website and try it just in case there an error soemwhere.  I really appreciate your help.  

Here is my web.config code:

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
  <appSettings/>
  
  
  
  <connectionStrings>
   <add name="DefaultConnectionString" providerName="System.Data.SqlClient" connectionString="Data Source=myserver;Network Library=DBMSSOCN;Initial Catalog=alajmi_Files;User ID=myid;Password=mypass" />
      
      </connectionStrings>
  
  <system.web>
  
  <profile enabled="true">
      <properties>
      <add name="UName" type="string"/>
      <add name="UEmail" type="string"/>
      
      </properties>
  </profile>
  
  <!-- This element is here to override the maxRequestLength attribute to allow
      for larger uploads than the default setting. -->
      <httpRuntime
         executionTimeout="110"
         maxRequestLength="112400"
         requestLengthDiskThreshold="80"
         useFullyQualifiedRedirectUrl="false"
         minFreeThreads="8"
         minLocalRequestFreeThreads="4"
         appRequestQueueLimit="5000"
         enableKernelOutputCache="true"
         enableVersionHeader="true"
         requireRootedSaveAsPath="true"
         enable="true"
         shutdownTimeout="90"
         delayNotificationTimeout="5"
         waitChangeNotification="0"
         maxWaitChangeNotification="0"
         enableHeaderChecking="true"
         sendCacheControlHeader="true"
               apartmentThreading="false" />

    <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
    <roleManager enabled="true" />
  <compilation debug="true"/>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Forms">
       <forms slidingExpiration="true" timeout="110"/>
    </authentication>
    <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
  </system.web>
  
  <location path="ChangePassword.aspx">
    
        <system.web>
          <authorization>
            <deny users="?"/>
            <allow users="*"/>
          </authorization>
        </system.web>
    
    </location>  
  
  <system.net>
      <mailSettings>
        <smtp from="[email protected]">
          <network host="webmail.orientalism.me" password="mypass" userName="myuser" />
        </smtp>
      </mailSettings>
    </system.net>
</configuration>

Thank you for your help
13 years ago
you alter key of sql server?

your key (not exists in version 1.5 or 1.6):
<add name="DefaultConnectionString" providerName="System.Data.SqlClient" connectionString="Data Source=myserver;Network Library=DBMSSOCN;Initial Catalog=alajmi_Files;User ID=myid;Password=mypass" />

key correct is:
<SqlServer ConnectionStringName="NopSqlConnection"/>

and after install is create automatic a connection in file connectionString.config... not complex... is simple.
13 years ago
Just had the same problem with DiscountASP.net. This is how I fixed it.

Edit ConnectionStrings.config:

<connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=YourSQLServer;Initial Catalog=YourSQLDB;User ID=YourSQLUsername;Password=YourSQLPassword;Connect Timeout=120" />
</connectionStrings>

Good Luck
13 years ago
I got exactly the same error.

I try to modify connectionstring as explain but now I have to reinstall the shop.

As i have already a database the installation doesn't work

How can i solve the probleme?
13 years ago
"LocalSqlServer" is the SQL connection string used by the default ASP.NET membership and role providers. NopCommerce has it own providers and doesn't use the "LocalSqlServer" connection string which I would say is why that string needs to be removed if it's in the web.config or cancelled out if it's in machine.config.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.