Configuration file is not well-formed XML error in website why?

时间:2019-04-08 13:40:54

标签: c# asp.net webforms web-config

I have this in web config

<connectionStrings>
   <add name="web" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ttt\SQL2K12;initial catalog=test;User ID=sa;Password=1222;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
   <add name="web" connectionString="data source=tttt\SQL2K12;initial catalog=test;User ID=sa; Password=555 providerName="System.Data.SqlClient" />
</connectionStrings>

but throws error:

Configuration file is not well-formed XML

why?

1 个答案:

答案 0 :(得分:2)

You are missing a double quote in the second Connection String.

Password=555 must be Password=555"

<add name="GalitosWebConnectionString" connectionString="data source=VLSAD0ISD\SQL2K12;initial catalog=test;User ID=sa; Password=555" providerName="System.Data.SqlClient" />

And it's better to not use the sa login for websites. If someone hacked the site they would also have full control over the DB.