【发布时间】:2010-02-04 16:20:15
【问题描述】:
我学习使用 .Net 的内置配置文件提供程序,并拥有以下内容 问题:
我读到 machine.config-settings 可以被 web.config-settings 覆盖 .Net 应用程序。 machine.config 文件中的以下设置是相关的 对我来说:
<connectionStrings>
<add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;
Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<profile><providers><add name="AspNetSqlProfileProvider"connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></providers></profile>
这些设置用于设置本地配置文件。 但是,当我将设置复制到我的应用程序的 web.config 并更改 machine.config 设置,以便它们不再工作,我得到一个配置 错误。 例如,我将 machine.config 中的提供者名称更改为“Local”。 这应该没问题,因为设置被覆盖了。但是,运行时 我收到错误的应用程序:
“条目“AspNetSQLProvider 已添加”(我的翻译)
【问题讨论】:
标签: asp.net web-config