【发布时间】:2014-03-26 20:13:13
【问题描述】:
我的web.debug.config 和web.release.config 文件有点问题。
更具体地说,我的网页将只使用默认的web.config 文件,而完全忽略debug 和release 文件。
这不仅发生在我在本地运行项目时,而且在我将其发布到 IIS 服务器时也会发生。
我正在使用 Visual Studio 2010 Ultimate(无 Service Pack)。
这里是配置文件:
web.config:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="MyConn" connectionString="SomeConnectionString"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
web.debug.config和web.release.config:
<?xml version="1.0"?>
<configuration xmlns:xtd="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyConn" connectionString="SomeOtherConnectionString"
providerName="System.Data.SqlClient"
xtd:Transform="Replace"
xtd:Locator="Match(name)"/>
</connectionStrings>
</configuration>
正如我之前提到的,该网站使用来自web.config 文件的连接字符串,而不是来自web.release.config 的连接字符串。
另一个有趣的地方是,在我发布项目的物理文件夹中,所有三个config 文件都存在;每个都与它们在 VS 解决方案中出现的完全相同。
有什么建议吗?
【问题讨论】:
-
感谢编辑,伙计们。
标签: visual-studio-2010 web-config