Web.Debug.config 和 Web.Release.Config 文件有什么用? [英] What are the Web.Debug.config and Web.Release.Config files for?

查看:26
本文介绍了Web.Debug.config 和 Web.Release.Config 文件有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到 Visual Studio 2010 和 MVC 2.0,我注意到 Web.config 附加了两个附加文件?这些文件是否用于指定调试和发布特定设置,以免弄乱主 Web.config?

I just upgraded to Visual Studio 2010 and MVC 2.0 and I noticed the Web.config has two additional files attached to it? Are these files used to specify debug and release specific settings, so you don't clutter up the main Web.config?

如果我在调试和发布 Web.configs 中分别有本地和远程连接字符串,在根 Web.config 文件中放置连接字符串是否有意义?

Does it even make sense to place a connection string in the root Web.config file if I have a local and remote one in the debug and release Web.configs respectively?

谢谢!

推荐答案

这是 Visual Studio 2010 的新 Web.config 转换功能.更多信息在这里.

It's the new Web.config transformation feature of Visual Studio 2010. More information here.

这些文件是否用于指定调试和发布特定设置,以免弄乱主 web.config?

Are these files used to specify debug and release specific settings, so you don't clutter up the main web.config?

它不仅限于三个文件,您(理论上)可以拥有与环境一样多的文件.顶级"Web.config 提供了 Web 配置的模板.它下的文件提供特定于该环境的替换值(例如,如果您有不同的本地/阶段/测试/任何连接字符串).

It isn't limited to three files, you could (in theory) have as many files as you have environments. The "top level" Web.config provides a template of your web config. The files under it provide replacement values specific to that environment (like if you have different connection strings for local/stage/test/whatever).

如果我在调试和发布 web.configs 中分别有本地和远程连接字符串,那么在根 web.config 文件中放置一个连接字符串是否有意义.

Does it even make sense to place a connection string in the root web.config file if I have have a local and remote one in the debug and release web.configs respectively.

它只有在环境之间不会改变时才有意义.听起来在您的情况下确实如此,在您的情况下,将其保留在 Web.config 中是没有意义的.

It would only make sense if it wasn't going to change between environments. Sounds like in your case it does so, in your case no, it would not make sense to leave it in the Web.config.

这篇关于Web.Debug.config 和 Web.Release.Config 文件有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆