It is misplaced. You are inside appSettings and you have another connectionStrings section a bit ealier outside of appSettings so it would give rather something such as :
I have tried to correct my solution with the code but it gives the same error!
Warning 1 The element 'configSections' has invalid child element 'connectionStrings'. List of possible elements expected: 'section, sectionGroup'. C:\Users\Andrew\Documents\Visual Studio 2012\CU1\ContosoUniversity\Web.config 10 6 ContosoUniversity
Warning 2 The element 'entityFramework' has invalid child element 'providers'. C:\Users\Andrew\Documents\Visual Studio 2012\CU1\ContosoUniversity\Web.config 91 6 ContosoUniversity
Error 3 Unrecognized element. C:\Users\Andrew\Documents\Visual Studio 2012\CU1\ContosoUniversity\Web.config 10
It seems your introduced another error. Now connectionStrings is inside configSections when it should follow it that is now you likely have :
<configSections> : open the configSections
<section etc/> : declare a section inside configSections
<connectionsStrings> : adds a connectionStrings child wiithin the opened congiSections which is not valid
When previously you had :
<configSections> : open the configSections
<section etc/> : declare a section isnide configSections
</configSections> : closes configSection
<connectionStrings> : now opens a section for connectionStrings
Member
251 Points
423 Posts
Web.Config error
May 07, 2014 12:54 PM|Markus33|LINK
Can someone please explain to my why I keep ghetting the following error?
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-ContosoUniversity-20140501183858;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-ContosoUniversity-20140501183858.mdf" />
</connectionStrings>
<appSettings>
<connectionStrings> //error is here!!!
<add name="SchoolContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=ContosoUniversity1;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
All-Star
48260 Points
17978 Posts
Re: Web.Config error
May 07, 2014 01:05 PM|PatriceSc|LINK
Hi,
It is misplaced. You are inside appSettings and you have another connectionStrings section a bit ealier outside of appSettings so it would give rather something such as :
If it doesn't help or still have an error, please quote the exact error message (or the best english translation you can do).
Member
251 Points
423 Posts
Re: Web.Config error
May 07, 2014 05:27 PM|Markus33|LINK
I have tried to correct my solution with the code but it gives the same error!
Warning 1 The element 'configSections' has invalid child element 'connectionStrings'. List of possible elements expected: 'section, sectionGroup'. C:\Users\Andrew\Documents\Visual Studio 2012\CU1\ContosoUniversity\Web.config 10 6 ContosoUniversity
Warning 2 The element 'entityFramework' has invalid child element 'providers'. C:\Users\Andrew\Documents\Visual Studio 2012\CU1\ContosoUniversity\Web.config 91 6 ContosoUniversity
Error 3 Unrecognized element. C:\Users\Andrew\Documents\Visual Studio 2012\CU1\ContosoUniversity\Web.config 10
Config Source:
All-Star
48260 Points
17978 Posts
Re: Web.Config error
May 07, 2014 05:40 PM|PatriceSc|LINK
It seems your introduced another error. Now connectionStrings is inside configSections when it should follow it that is now you likely have :
<configSections> : open the configSections
<section etc/> : declare a section inside configSections
<connectionsStrings> : adds a connectionStrings child wiithin the opened congiSections which is not valid
When previously you had :
<configSections> : open the configSections
<section etc/> : declare a section isnide configSections
</configSections> : closes configSection
<connectionStrings> : now opens a section for connectionStrings
Member
251 Points
423 Posts
Re: Web.Config error
May 07, 2014 05:54 PM|Markus33|LINK
Here is the webconfig at the moment.. It still has the error! Really difficult to corrrect to me.
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-ContosoUniversity-20140501183858;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-ContosoUniversity-20140501183858.mdf" />
<connectionStrings>
<add name="SchoolContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=ContosoUniversity1;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
All-Star
52493 Points
15665 Posts
Re: Web.Config error
May 07, 2014 10:40 PM|oned_gk|LINK
What error message?
Suwandi - Non Graduate Programmer
All-Star
23975 Points
4084 Posts
Re: Web.Config error
May 08, 2014 02:12 AM|Starain chen - MSFT|LINK
Hi Markus33,
The DefaultConnection should be in the connectionStrings section.
Thanks
Best Regards