如何在不更改代码的情况下设置 web.config 以构建到多环境? [英] How to setup web.config for build to multi-environments without code changes?

查看:15
本文介绍了如何在不更改代码的情况下设置 web.config 以构建到多环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在一个非常有趣的环境中开发了一个应用.此应用程序有 6 或 7 个并行级别,开发人员只能触及第 1 2 个级别.作为公司政策的一部分,所有构建都作为 Tivoli 包完成,设置起来非常复杂.

I recently worked on an app in a very interesting environment. There was 6 or 7 parallel levels for this application and only the 1st 2 levels were able to be touched by developers. As part of the company policy all builds were done as Tivoli packages, and very complex to setup.

最后一个问题是不允许代码更改超过 1 级或开发"服务器,因此 web.config 包含多个加密的环境变量部分.该应用程序旨在通过路径和在 IIS 中设置的变量来感知其所处的环境.

The final kicker was that no code changes are allowed past the 1st level or "Dev" servers so web.config contained multiple encrypted sections of environment variables. The application is built to sense what environment its on by path and variables set in IIS.

这是一个需要维护的野兽,那么针对此类问题的简单或更好的架构是什么?

This is a beast to maintain so what is a simple or better architecture for this type of problem?

推荐答案

最新版本的 ASP.NET 现在支持 Web 配置转换,允许您更改项目中的特定设置以进行部署、测试或暂存.这是一个很棒的 Tom Hundley 的介绍.

The latest version of ASP.NET now supports web config transformations, allowing you to change specific settings within your project for deployment, testing or staging. Here's a great intro by Tom Hundley.

这篇关于如何在不更改代码的情况下设置 web.config 以构建到多环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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