.NET 4.0 和他的 Web.Config 的 XDT
我正在尝试在 4.0 Web 应用程序中使用 XDT,但我只是不知道如何使用!我知道这可能很奇怪(至少,从那时起我读过的所有帖子,每个人似乎都很容易做到这一点,但嗯,不是我!!)。没有任何作用。这是我尝试过的:
这是我的 Web.Debug.Config :
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="Replace">
<add key="ConnectionString.SQL Server (SqlClient)"
value="data source=test;initial catalog=TestDB;User ID=sa;Password=testpsw;persist security info=False;packet size=4096" />
</appSettings>
<connectionStrings xdt:Transform="Replace">
<add name="ASP.net Authentication"
connectionString="data source=(local);initial catalog=TestDB;User ID=sa;Password=testpsw;persist security info=False" />
</connectionStrings>
</configuration>
在我的 web.config 中,我有这个和很多其他东西,但我只想更改这些。
<?xml version="1.0"?>
[...]
<configuration>
<appSettings>
<add key="ConnectionString.SQL Server (SqlClient)"
value="data source=[THIS WILL CHANGE];initial catalog=[THIS WILL CHANGE];User ID=[THIS WILL CHANGE];Password=[THIS WILL CHANGE];persist security info=False;packet size=4096" />
</appSettings>
<connectionStrings>
<add name="ASP.net Authentication"
connectionString="data source=[THIS WILL CHANGE];initial catalog=[THIS WILL CHANGE];User ID=[THIS WILL CHANGE];Password=[THIS WILL CHANGE];persist security info=False" />
</connectionStrings>
</configuration>
[...]
我做错了什么?
注意:我已经阅读了 MSDN 上的帖子,但它对我没有帮助......
I'm trying to use the XDT in a 4.0 web application and I just don't figure out how! I know this is maybe weird (At least, all thread I've read since then, everybody seems to do it easly but hum, not me!!). Nothing working. Here's what I've tryed :
Here's my Web.Debug.Config :
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="Replace">
<add key="ConnectionString.SQL Server (SqlClient)"
value="data source=test;initial catalog=TestDB;User ID=sa;Password=testpsw;persist security info=False;packet size=4096" />
</appSettings>
<connectionStrings xdt:Transform="Replace">
<add name="ASP.net Authentication"
connectionString="data source=(local);initial catalog=TestDB;User ID=sa;Password=testpsw;persist security info=False" />
</connectionStrings>
</configuration>
In my web.config, I've got this and plenty of other things but I just want to change those.
<?xml version="1.0"?>
[...]
<configuration>
<appSettings>
<add key="ConnectionString.SQL Server (SqlClient)"
value="data source=[THIS WILL CHANGE];initial catalog=[THIS WILL CHANGE];User ID=[THIS WILL CHANGE];Password=[THIS WILL CHANGE];persist security info=False;packet size=4096" />
</appSettings>
<connectionStrings>
<add name="ASP.net Authentication"
connectionString="data source=[THIS WILL CHANGE];initial catalog=[THIS WILL CHANGE];User ID=[THIS WILL CHANGE];Password=[THIS WILL CHANGE];persist security info=False" />
</connectionStrings>
</configuration>
[...]
What I'm doing wrong?
Note : I've read the post from MSDN and it do not helped me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在 Web 应用程序上执行 web.config 转换,您必须部署该项目。右键单击该项目并转到“发布”。
仅在本地构建项目并不能执行转换。
To perform a web.config transformation on a web application, you have to deploy the project. Right click on the project and go to Publish.
Just building a project locally will not perform the transformation.