你如何使用在Machine.config,或者是你? [英] How are you using the Machine.config, or are you?

查看:117
本文介绍了你如何使用在Machine.config,或者是你?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关ASP.Net应用程序部署什么类型的信息(如果有的话),你在machine.config存储?

For ASP.Net application deployment what type of information (if any) are you storing in the machine.config?

如果你不使用它,你如何管理可能为每个环境改变环境的具体配置设置?

If you're not using it, how are you managing environment specific configuration settings that may change for each environment?

我在寻找一些最佳做法以及各自的好处/陷阱。我们即将在两个月内部署一个全新的应用程序来生产,我有这些类型的决策一定的自由度。我想确保我接近的东西最好的方式,并试图避免在日后拍摄自己的脚。

I'm looking for some "best practices" and the benefits/pitfalls of each. We're about to deploy a brand new application to production in two months and I've got some latitude in these types of decisions. I want to make sure that I'm approaching things in the best way possible and attempting to avoid shooting myself in the foot at a later date.

FYI我们目前正在使用它(machine.config中)只是数据库连接信息和存储可能在配置表中更改数据库中的所有其他变量。

FYI We're using it (machine.config) currently for just the DB connection information and storing all other variables that might change in a config table in the database.

感谢您事先输入/洞察力。

Thanks in advance for input/insight.

推荐答案

我们正在使用machine.config中添加一个关键的环境,然后在这excactly所有环境相同的Web.config一个部分考虑。这样,我们可以做一个真正的Xcopy部署。

We are considering using machine.config to add one key for the environment, and then have one section in the web.config which is excactly the same for all environments. This way we can do a "real" XCopy deployment.

例如。在machine.config为每台计算机(本地开发工作站,服务器阶段,构建服务器,生产服务器),我们将添加以下内容:

E.g. in the machine.config for every computer (local dev workstations, stage servers, build servers, production servers), we'll add the following:

<appSettings>
    <add key="Environment" value="Staging"/>
</appSettings>

然后,是环境特定的任何配置元素获得附加的环境,就像这样:

Then, any configuration element that is environment-specific gets the environment appended, like so:

<connectionStrings>
    <add name="Customers.Staging" provider="..." connectionString="..."/>
</connectionStrings>
<appSettings>
    <add key="NTDomain.Staging" value="test.mydomain.com"/>
</appSettings>

一个问题,我们没有一个解决方案是如何让说,在web.config中跟踪调试环境,而不是活的环境。

One problem that we don't have a solution for is how to enable say tracing in web.config for debugging environment and not for live environment.

的另一个问题是,该活的ConnectionString含。用户名和密码,现在在你的源代码控制系统。但是,这是不是一个问题我们。

Another problem is that the live connectionstring incl. username and password is now in your Source Control system. This is however not a problem for us.

这篇关于你如何使用在Machine.config,或者是你?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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