我想从app.config获取数据,并且我总是得到零。在app.config是在这里:无法读取app.config,为什么?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="ExplorerContext" connectionString="metadata=res://*/ExplorerData.csdl|res://*/ExplorerData.ssdl|res://*/ExplorerData.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MYT\SQLEXPRESS;Initial Catalog=Explorer;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
有人能解释一下什么是错的,为什么我不能得到的数值, System.Configuration.ConfigurationManager.AppSettings.Count
始终为0
我fogot指定我用的类库,我” m试图使用NUnit项目来检查。而这个类库调用了一个使用ADO.NET Entity Project的项目(也是类库)。
我知道这是旧的,如果没有答案在这里帮助尝试:http://stackoverflow.com/questions/4280970/configurationmanager-appsettings-getting-null – 2012-07-25 04:16:49