我已经添加了参考 System.Configuration 并且仍然收到该错误。我正在使用VS2010。这是代码
<configuration>
<connectionStrings>
<add name="MESConnection" connectionString="Server=.\SQLEXPRESS;Database=MES;Trusted_Connection=true"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
</system.web>
以及背后的代码:
private static string _connStr = ConfigurationManager.ConnectionStrings["MESConnection"].ConnectionString;
有任何想法吗?