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

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

问题描述

任何人有处理环境之间的web.config设置差异什么好的建议?我认为建立在我们的源代码控制系统之外,但在网络层次结构的配置文件夹,并且具有部署过程中复制适当的配置文件(web.dev.config,web.staging.config,web.production.config )成在部署Web文件夹。我也看到了有关如何以编程方式更改的配置设置的职位(WCF端点,连接字符串等),应用程序启动时。

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?

更新2010年9月

值得注意的是Visual Studio 2010中通过<一个增加这种能力href=\"http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx\">web.config转换。当您使用生成配置管理器(建|配置管理器...)来为你的项目创建不同的配置(比如,调试,开发,分期和释放),VS增加了网络*配置文件来解决。默认的web.config文件包含您将用于调试基准设置。 web.release.config,web.staging.config等包含将被应用XSLT转换时,你发布你的项目的基础上积极构建配置。

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.

推荐答案

随着新VS您可以使用Web配置转换。

With the new VS you can use web config transformations.

在这里阅读更多:<一href=\"http://msdn.microsoft.com/en-us/library/dd465326.aspx\">http://msdn.microsoft.com/en-us/library/dd465326.aspx

这篇关于区分开发,分期和生产环境之间的web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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