在开发人员,分期和生产环境之间区分web.config [英] Differentiating web.config between dev, staging and production environments
问题描述
这里是最佳实践,每个人都有这些或其他方法的经验?
更新2010年9月
值得注意的是,Visual Studio 2010通过 web.config转换。当您使用构建配置管理器(Build | Configuration Manager ...)为您的项目(例如Debug,Dev,Staging和Release)创建不同的配置时,VS将Web。*。config文件添加到解决方案中。默认的web.config包含用于调试的基准设置。 web.release.config,web.staging.config等包含XSLT转换,当您根据活动的构建配置发布项目时,将会应用它们。
使用新的VS可以使用Web配置转换。
请阅读更多资讯: http://msdn.microsoft.com/en-us/library/dd465326.aspx
Anyone have any good tips on handling differences in web.config settings between environments? I've considered creating a 'config' folder in our source control system but outside of the web hierarchy, and having the deployment process copy the appropriate config files (web.dev.config,web.staging.config, web.production.config) into the web folder upon deployment. I've also seen posts on how to programmatically change the config settings (WCF endpoints, connection strings, etc) when the app starts.
What are considered best practices here, and what experiences has everyone had with these or other approaches?
Update Sep 2010
It's worth noting that Visual Studio 2010 adds this ability via web.config transforms. When you use the build configuration manager (Build|Configuration Manager...) to create different configurations for your project (say, Debug, Dev, Staging and Release), VS adds web.*.config files to the solution. The default web.config contains baseline settings that you'll use for debugging. web.release.config, web.staging.config, etc contain XSLT transforms that will be applied whenever you publish your project based on the active build configuration.
With the new VS you can use web config transformations.
Read more here: http://msdn.microsoft.com/en-us/library/dd465326.aspx
这篇关于在开发人员,分期和生产环境之间区分web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!