The "connectionStrings" configuration section could not be read because the section declaration is missing

I am trying to move my webpage (C #) to an ISS 7.5 server.

I read what I need to put in WEBCONFIG in order to communicate with SQL Server 2008.

I've already done it.

Here is my WEBCONFIG

<?xml version="1.0" encoding="UTF-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <connectionstrings> <!-- <remove name="LocalSqlServer" /> --> <add name="conexionsql" connectionstring="Data Source=FCH-DESARROLLO;Initial Catalog=DesaInterno;Integrated Security=True;User ID=usuario_de_conexion;Password=a" providerName="System.Data.SqlClient"/> </connectionstrings> <system.web> <!--<identity impersonate="true" /> --> <compilation debug="true" targetFramework="4.5"> <assemblies> <!-- <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> --> <add assembly="*" /> </assemblies> </compilation> <!-- <httpRuntime targetFramework="4.5"/> --> <!-- <authentication mode="Windows" /> --> <authorization> <deny users="?" /> </authorization> </system.web> <!-- <system.webServer> --> <!-- <defaultDocument> <files> <add value="index.aspx" /> </files> </defaultDocument> --> <!--</system.webServer> --> <!-- <connectionStrings> <remove name="LocalSqlServer" /> <add connectionString="Server=10.10.201.79;Database=DesaInterno;Integrated Security=true" name="LocalSqlServer" /> </connectionStrings> --> </configuration> 

When I try to run my application in IIS, an error appears.

HTTP Error 500.19 - Internal Server Error The configuration section "connectionStrings" could not be read because the declaration section is missing

+5
source share
3 answers
  <configuration> <system.web> <compilation debug="true" targetFramework="4.0"/> </system.web> <connectionStrings> <add name="#" connectionString="#" providerName="System.Data.SqlClient"/> </connectionStrings> </configuration> 

replace your code with the above configuration

and also the tag must be accurate, as indicated

let me know if you are still stuck, this might be another problem.

0
source

The connection string section has the following definition and is case sensitive :

 <connectionStrings> <add name="conexionsql" connectionstring="Data Source=FCH-DESARROLLO;Initial Catalog=DesaInterno;Integrated Security=True;User ID=usuario_de_conexion;Password=a" providerName="System.Data.SqlClient"/> </connectionStrings> 
0
source

This is because the keys are case sensitive and you have all lowercase connectionstrings , just change the connectionstrings to the correct case (note the uppercase S ).

The full configuration (with deleted items removed) now looks like this:

 <?xml version="1.0" encoding="UTF-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <connectionStrings> <add name="conexionsql" connectionstring="Data Source=FCH-DESARROLLO;Initial Catalog=DesaInterno;Integrated Security=True;User ID=usuario_de_conexion;Password=a" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="*" /> </assemblies> </compilation> <authorization> <deny users="?" /> </authorization> </system.web> </configuration> 
-1
source

Source: https://habr.com/ru/post/1210463/


All Articles