Problem with web.config

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oakesy
    New Member
    • Jul 2008
    • 3

    Problem with web.config

    Hi,
    I receive this message when I try to open a website which I uploaded using FTP:

    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 146: <roleManager>
    Line 147: <providers>
    Line 148: <add name="AspNetSql RoleProvider" connectionStrin gName="LocalSql Server" applicationName ="/" type="System.We b.Security.SqlR oleProvider, System.Web, Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
    Line 149: <add name="AspNetWin dowsTokenRolePr ovider" applicationName ="/" type="System.We b.Security.Wind owsTokenRolePro vider, System.Web, Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
    Line 150: </providers>


    Source File: c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Config\machine .config Line: 148


    I have read some other forums but haven't succeeded in solving the problem.

    But I don't know a great amount of code so could someone please help me?

    Thanks,
    Nathan
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Is 'LocalSqlServer ' defined in your web.config under the SQLConnections section?

    Comment

    • oakesy
      New Member
      • Jul 2008
      • 3

      #3
      I'm not sure!

      This is a copy of the web.config file...

      <?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\Micros oft.Net\Framewo rk\v2.x\Config
      -->
      <configuratio n>
      <configSections >
      <sectionGroup name="system.we b.extensions" type="System.We b.Configuration .SystemWebExten sionsSectionGro up, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5">
      <sectionGroup name="scripting " type="System.We b.Configuration .ScriptingSecti onGroup, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5">
      <section name="scriptRes ourceHandler" type="System.We b.Configuration .ScriptingScrip tResourceHandle rSection, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5" requirePermissi on="false" allowDefinition ="MachineToAppl ication"/>
      <sectionGroup name="webServic es" type="System.We b.Configuration .ScriptingWebSe rvicesSectionGr oup, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5">
      <section name="jsonSeria lization" type="System.We b.Configuration .ScriptingJsonS erializationSec tion, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5" requirePermissi on="false" allowDefinition ="Everywhere "/>
      <section name="profileSe rvice" type="System.We b.Configuration .ScriptingProfi leServiceSectio n, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5" requirePermissi on="false" allowDefinition ="MachineToAppl ication"/>
      <section name="authentic ationService" type="System.We b.Configuration .ScriptingAuthe nticationServic eSection, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5" requirePermissi on="false" allowDefinition ="MachineToAppl ication"/>
      <section name="roleServi ce" type="System.We b.Configuration .ScriptingRoleS erviceSection, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5" requirePermissi on="false" allowDefinition ="MachineToAppl ication"/>
      </sectionGroup>
      </sectionGroup>
      </sectionGroup>
      </configSections>
      <appSettings/>
      <connectionStri ngs/>
      <system.web>
      <!--
      Set compilation debug="true" to insert debugging
      symbols into the compiled page. Because this
      affects performance, set this value to true only
      during development.

      Visual Basic options:
      Set strict="true" to disallow all data type conversions
      where data loss can occur.
      Set explicit="true" to force declaration of all variables.
      -->
      <roleManager enabled="true" />
      <compilation debug="true" strict="false" explicit="true" >
      <assemblies>
      <add assembly="Syste m.Core, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
      <add assembly="Syste m.Web.Extension s, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      <add assembly="Syste m.Data.DataSetE xtensions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
      <add assembly="Syste m.Xml.Linq, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
      </assemblies>
      </compilation>
      <pages>
      <namespaces>
      <clear/>
      <add namespace="Syst em"/>
      <add namespace="Syst em.Collections"/>
      <add namespace="Syst em.Collections. Generic"/>
      <add namespace="Syst em.Collections. Specialized"/>
      <add namespace="Syst em.Configuratio n"/>
      <add namespace="Syst em.Text"/>
      <add namespace="Syst em.Text.Regular Expressions"/>
      <add namespace="Syst em.Linq"/>
      <add namespace="Syst em.Xml.Linq"/>
      <add namespace="Syst em.Web"/>
      <add namespace="Syst em.Web.Caching"/>
      <add namespace="Syst em.Web.SessionS tate"/>
      <add namespace="Syst em.Web.Security "/>
      <add namespace="Syst em.Web.Profile"/>
      <add namespace="Syst em.Web.UI"/>
      <add namespace="Syst em.Web.UI.WebCo ntrols"/>
      <add namespace="Syst em.Web.UI.WebCo ntrols.WebParts "/>
      <add namespace="Syst em.Web.UI.HtmlC ontrols"/>
      </namespaces>
      <controls>
      <add tagPrefix="asp" namespace="Syst em.Web.UI" assembly="Syste m.Web.Extension s, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      <add tagPrefix="asp" namespace="Syst em.Web.UI.WebCo ntrols" assembly="Syste m.Web.Extension s, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      </controls>
      </pages>
      <!--
      The <authentication > section enables configuration
      of the security authentication mode used by
      ASP.NET to identify an incoming user.
      -->
      <authenticati on mode="Forms" />
      <customErrors mode="Off" />

      <!--
      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="off">
      <error statusCode="403 " redirect="NoAcc ess.htm" />
      <error statusCode="404 " redirect="FileN otFound.htm" />
      </customErrors>
      -->
      <httpHandlers >
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false " type="System.We b.Script.Servic es.ScriptHandle rFactory, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      <add verb="*" path="*_AppServ ice.axd" validate="false " type="System.We b.Script.Servic es.ScriptHandle rFactory, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      <add verb="GET,HEAD" path="ScriptRes ource.axd" type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5" validate="false "/>
      </httpHandlers>
      <httpModules>
      <add name="ScriptMod ule" type="System.We b.Handlers.Scri ptModule, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      </httpModules>
      </system.web>
      <system.codedom >
      <compilers>
      <compiler language="c#;cs ;csharp" extension=".cs" warningLevel="4 " type="Microsoft .CSharp.CSharpC odeProvider, System, Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9">
      <providerOpti on name="CompilerV ersion" value="v3.5"/>
      <providerOpti on name="WarnAsErr or" value="false"/>
      </compiler>
      <compiler language="vb;vb s;visualbasic;v bscript" extension=".vb" warningLevel="4 " type="Microsoft .VisualBasic.VB CodeProvider, System, Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9">
      <providerOpti on name="CompilerV ersion" value="v3.5"/>
      <providerOpti on name="OptionInf er" value="true"/>
      <providerOpti on name="WarnAsErr or" value="false"/>
      </compiler>
      </compilers>
      </system.codedom>
      <!--
      The system.webServe r section is required for running ASP.NET AJAX under Internet
      Information Services 7.0. It is not necessary for previous version of IIS.
      -->
      <system.webServ er>
      <validation validateIntegra tedModeConfigur ation="false"/>
      <modules>
      <remove name="ScriptMod ule"/>
      <add name="ScriptMod ule" preCondition="m anagedHandler" type="System.We b.Handlers.Scri ptModule, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      </modules>
      <handlers>
      <remove name="WebServic eHandlerFactory-Integrated"/>
      <remove name="ScriptHan dlerFactory"/>
      <remove name="ScriptHan dlerFactoryAppS ervices"/>
      <remove name="ScriptRes ource"/>
      <add name="ScriptHan dlerFactory" verb="*" path="*.asmx" preCondition="i ntegratedMode" type="System.We b.Script.Servic es.ScriptHandle rFactory, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      <add name="ScriptHan dlerFactoryAppS ervices" verb="*" path="*_AppServ ice.axd" preCondition="i ntegratedMode" type="System.We b.Script.Servic es.ScriptHandle rFactory, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      <add name="ScriptRes ource" preCondition="i ntegratedMode" verb="GET,HEAD" path="ScriptRes ource.axd" type="System.We b.Handlers.Scri ptResourceHandl er, System.Web.Exte nsions, Version=3.5.0.0 , Culture=neutral , PublicKeyToken= 31BF3856AD364E3 5"/>
      </handlers>
      </system.webServe r>
      <runtime>
      <assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
      <dependentAssem bly>
      <assemblyIdenti ty name="System.We b.Extensions" publicKeyToken= "31bf3856ad364e 35"/>
      <bindingRedirec t oldVersion="1.0 .0.0-1.1.0.0" newVersion="3.5 .0.0"/>
      </dependentAssemb ly>
      <dependentAssem bly>
      <assemblyIdenti ty name="System.We b.Extensions.De sign" publicKeyToken= "31bf3856ad364e 35"/>
      <bindingRedirec t oldVersion="1.0 .0.0-1.1.0.0" newVersion="3.5 .0.0"/>
      </dependentAssemb ly>
      </assemblyBinding >
      </runtime>
      <system.net>
      <mailSettings >
      <smtp from="no-reply@swanhillp c.org.au">
      <network host="localhost " password="" userName="" />
      </smtp>
      </mailSettings>
      </system.net>
      </configuration>


      Thanks again

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        In your web.config you have:

        <appSettings/>
        <connectionStri ngs/>


        These are empty tags.
        I'm assuming that you're using a connection string by retrieving it through ConfigurationMa nager.Connectio nStrings("blahb la").Connection String. In order for this to work you have to add the connection string to the <connectionStri ngs> section in your web.config file.

        Eg:

        [code=xml]
        <connectionStri ngs>
        <add name="blahbla" connectionStrin g="data source=MYSOURCE ; initial catalog=TheInit ialCatalog; user id=USERID;passw ord=ThePassword " providerName="S ystem.Data.SqlC lient"/>
        </connectionStrin gs>[/code]


        -Frinny

        Comment

        • oakesy
          New Member
          • Jul 2008
          • 3

          #5
          How do i find out exactly what i need to type??

          thanks in advance!

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by oakesy
            How do i find out exactly what i need to type??

            thanks in advance!
            It depends on how you are connecting to the database.
            Check out the MSDN library for Connection String Syntax.

            -Frinny

            Comment

            Working...