App.Config中和的Web.Config之间的差异? [英] Differences between App.Config and Web.Config?

查看:256
本文介绍了App.Config中和的Web.Config之间的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安全subsititute的app.config当人们的答案是指的web.config?

when building a desktop app in wpf can you read documentation of problems and safely subsititute 'app.config' when people's answer's refer to 'web.config'?

如果有,你有看出来的任何明显的陷阱?

if so are there any glaring GOTCHAS you have to look out for?

TNX

推荐答案

阅读文档

的Web.config和App.config中

的选择
  配置文件名是由托管环境中,您确定
  选择该服务。如果您使用的是IIS来承载您的服务,使用
  Web.config文件。如果你正在使用任何其他托管环境中,使用
  一个App.config文件。

The choice of the configuration file name is determined by the hosting environment you choose for the service. If you are using IIS to host your service, use a Web.config file. If you are using any other hosting environment, use an App.config file.

在Visual Studio中,命名的App.config文件被用于创建
  最终的配置文件。最终名称实际用于
  配置取决于程序集名称。例如,一个组件
  名为Cohowinery.exe有一个最终配置文件名
  Cohowinery.exe.config。但是,你只需要修改
  App.config文件。该文件所做的更改会自动发
  在编译时最后的应用程序配置文件。

In Visual Studio, the file named App.config is used to create the final configuration file. The final name actually used for the configuration depends on the assembly name. For example, an assembly named "Cohowinery.exe" has a final configuration file name of "Cohowinery.exe.config". However, you only need to modify the App.config file. Changes made to that file are automatically made to the final application configuration file at compile time.

在使用App.config中,文件中的配置系统将合并
  与Machine.config文件的内容App.config文件时,
  应用程序启动和应用配置。这种机制
  在Machine.config文件中定义允许计算机范围的设置。
  app.config文件可用于覆盖的设置
  Machine.config文件;您还可以锁定在设置
  Machine.config文件,使他们习惯。在Web.config的情况下,
  配置系统融合中的所有目录中的Web.config文件
  领导到应用程序目录进入配置的
  被应用。

In using an App.config, file the configuration system merges the App.config file with content of the Machine.config file when the application starts and the configuration is applied. This mechanism allows machine-wide settings to be defined in the Machine.config file. The App.config file can be used to override the settings of the Machine.config file; you can also lock in the settings in Machine.config file so that they get used. In the Web.config case, the configuration system merges the Web.config files in all directories leading up to the application directory into the configuration that gets applied.

这篇关于App.Config中和的Web.Config之间的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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