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

查看:264
本文介绍了你如何使用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)只是为了DB连接信息,并存储所有可能在数据库配置表中更改的其他变量。 / p>

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.

推荐答案

我们正在考虑使用machine.config为环境添加一个键,然后在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.

另一个问题是,live连接串包含。用户名和密码现在在您的源代码管理系统中。但这对我们来说不是问题。

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天全站免登陆