在开发人员,分期和生产环境之间区分web.config [英] Differentiating web.config between dev, staging and production environments

查看:163
本文介绍了在开发人员,分期和生产环境之间区分web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人在处理环境之间的web.config设置的差异方面有任何好的提示?我考虑在我们的源代码控制系统中创建一个config文件夹,但是在Web层次结构之外,并且部署过程复制相应的配置文件(web.dev.config,web.staging.config,web.production.config )部署到Web文件夹中。我也看过有关如何在应用程序启动时以编程方式更改配置设置(WCF端点,连接字符串等)的信息。



这里是最佳实践,每个人都有这些或其他方法的经验?



更新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屋!

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