在ASP.NET中的开发/ UAT / Prod环境之间切换配置的最佳方式? [英] Best way to switch configuration between Development/UAT/Prod environments in ASP.NET?

查看:111
本文介绍了在ASP.NET中的开发/ UAT / Prod环境之间切换配置的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发我的网络应用程序 - 开发,UAT和Prod时,我需要在3种不同的环境之间切换。我在我的所有配置文件中有不同的数据库连接3.我看到通过更改所有引用,然后重建解决方案,也使用预处理器指令手动切换这些设置。是否有一个简单的方法来做这个基于一些变量,使配置不必修改时,部署到一个新的环境每次?

I need to switch among 3 different environments when developing my web app - Development, UAT, and Prod. I have different database connections in my configuration files for all 3. I have seen switching these settings done manually by changing all references and then rebuilding the solution, and also done with preprocessor directives. Is there an easy way to do this based on some variable so that the configuration doesn't have to be revised when deploying to a new environment every time?

推荐答案

对我来说,你似乎可以从 Visual Studio 2005 Web部署项目

To me it seems that you can benefit from the Visual Studio 2005 Web Deployment Projects.

这样,你可以让它根据构建更新/修改web.config文件的部分

With that, you can tell it to update/modify sections of your web.config file depending on the build configuration.

请参阅此博客条目从Scott Gu 快速概述/示例。

Take a look at this blog entry from Scott Gu for a quick overview/sample.

这篇关于在ASP.NET中的开发/ UAT / Prod环境之间切换配置的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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