web.config
<connectionStrings>
<add name="constr" connectionString="server=10.2.3.80;user id=abc;password=abc@123;database=clientdata;SslMode=none" providerName="System.Data.MySqlClient"/>
Dbconnection.cs
string connstr=ConfigurationManager.ConnectionStrings["constr"].ConnectionString
它给出了类似的错误 System.NullReferenceException:'对象引用未设置为对象的实例。'
System.Configuration.ConnectionStringSettingsCollection.this [string] .get返回null。