English 中文(简体)
为什么储存在登记处的“申请环境”?
原标题:Why aren t .NET "application settings" stored in the registry?
最佳回答

我认为这并不是一个答案。

  • The registry at the time of creating it looked like a good idea to store all settings for all programs in one place as oppose to the .ini files generally used before. At the time this increased performance as small .ini file reads from slow hard drives were costly, a single registry file somewhat increased performance. This is now different as hard drives are far faster and more and more settings have been dumped in the registry making it a burden on the system. You will see this if you install and uninstall lots of programs in windows it begins to slow down and eventually you probably end up reformatting.
  • An incorrect write to the registry even in the current user settings can ruin your system.
  • The registry doesn t help xcopy deployment of programs without specific code to handle lack of registry keys... This includes removing programs by simply deleting the folder in many cases
  • Greater permissions can be needed to install an application if it needs access to the registry
  • A .config file easily allows default application and user setting which can be modified on first run of the program by the end user
  • Allows .NET to potentially run on other systems without OS specific code. This can somewhat be seen with Silverlight and isolated storage.
  • Greater security through the use of Isolated Storage for the application and users
  • Gives Microsoft the possibility way in the future to have a managed code only OS without many old dependencies. Think of the framework as a layer between any OS and the managed code.
问题回答

另一个原因是,为了伪造登记处,必须获得更多的许可。 如果你只是编辑一个书状,那么你只需要拥有该书的权利。

  • The registry is huge so it can be cumbersome to locate the relevant information (even with searching).
  • It is possible to affect other applications by accident when modifying the registry.
  • If the registry is corrupted all applications may be affected (including the OS).
  • You need special purpose tools to search, modify and even copy the registry.

我倾向于混淆档案。

这是因为登记处是使用的一种ug梦,人们也这样做。 该公司还提供了支持微米部署。 在使用Xml文档进行配置后,如果不需要安装装置,你可以将一台机器转换成机器。 这在90年代是重写法典的最大投诉之一。

在登记册上,当你在很多组织禁止申请时,你必须准许修改。 为了修改申请的顺序,你还必须知道,在许多情况下,登记处很难找到哪儿。 它拥有与大多数其他材料分离的权利。 通常,你们所需要的一切环境都是容易地看待和修改的。

立即(但重要的)优势:

用户可以通过<密码>查询<>代码>配置文件,在重新安装/从备份中恢复功能的情况下,能够方便地恢复环境。 很难从登记价值中做到这一点。

转而将档案整理到登记处的一个重大优势是允许在旁边安装同一方案。 随着登记处的登记,这些重复安装的中央配置信息将重叠,但使用集束文档,信息将保存到每个具体安装。 用户组合倒置可能重叠(因为这些组合重新储存在用户数据夹中,并非具体放在安装线上),而是设想一种不同用户使用不同装置的情况,在这种情况下,这一潜在问题变得无关紧要。

我认为,造成这种情况的主要原因之一是更新申请。 当你安装更新设备(即使用ClickOnce)时,新环境实际上会进入一个新的轨道。 当你停下来时,新翻了一番,旧的环境仍然周围。 如果登记处被改用,则无法做到这一点。

其他原因包括:

  • Permissions (app settings always go into AppData/LocalAppData which requires no privileges)
  • Ease of maintenance/backups
  • Portability (it s rather difficult to deal with the registry using the .NET Compact Framework, and god help you if you re trying to support Mono).

在我看来,登记册是“当时看起来好想法”的一件事,因为其他登记者已经列举的许多原因。 根本不正确的做法是认识到,某些东西根本不是如此伟大的思想,而是使用一种更简单、更方便的替代方法,即使这似乎在某些方面是一种倒退。

我听到了相当实质性的传说,共享点和团队基础服务器使用的数据储存格式,由SQ支持,最初旨在取代窗口档案系统。 7. 如果是计划,那么窗口本来会获得/(有时会获得)交易数据储存。 这种数据储存方法可能以各种方式优先于登记处。

鉴于这一点,它很难把登记册的使用降至最低限度,因为它们正在推进因特网框架。

我认为,新手法有助于:

  • Give the applications the flexibility to provide their own configurations as an override to the default configurations provided - consider the case of web.config overriding the machine.config
  • Sometimes, it might not be possible to change the registry settings since you might not have the rights needed. So, a config file allows you to make changes applicable for your own application without needing the additional rights
  • With a registry entry, multiple application could potentially be using the same configuration. But if you change it for your application, you might cause un-intended behaviour on the other applications & you might not have complete information about this

只是想到的一些想法......

HTH.

我会问一问,方便远距离部署是决定因素。

适用性可以是原因之一。 申请文件夹可从一台电脑复制到其他计算机,申请环境将采用。 在使用多台电脑时,使用燃烧发动机。

我认为,这是一个相互依存的平台问题。 过去,许多申请都经过了开发,涉及的有:LC、Mac和Windows,有些是使用汇文档,另一些是登记处。

我认为,主要原因来自“委员会的经验”。 整个原则是将部件物体集中登记在登记处,以便任何申请都能使用,无需复制件。 这迅速导致我们出现问题。 多种应用很难使用同一组成部分的不同版本。

登记处的配置问题相同。 如果发展没有正确的话,有两种版本的同一申请可能是一个真正的问题。 很久以前,我们就使用多种甲骨质。

由于网络以及硬车和带宽的爆炸能力,档案重复已不再是一个令人关切的问题。 在你的双管项目中安装了附属设施,大大简化了申请的部署。 配置文件也是如此。 如果书记官处机器/用户结构有限,你可以接收同一申请的多份复印件/转稿。

Microsoft suggested both ways, because they have different capabilities. For example if you create some application for using in Active Directory, you can easily modify settings for thousands computers, even your application installed to different directories. If you choose xml you should know application folders for every PC or create some smart script to find them. But as many people said xml better for portability, settings backup and other.

因此,没有最佳办法。 需要登记的发展者——直接使用。 这不是如此困难的。 或许可以推断,微软公司为什么在登记处做了一些评估。

我认为,在申请设置方面存在着一个巨大的安全问题(简编档案),可以在任何文本编辑中加以编辑,并改动所有事项。

让我们说,连接储存起来,约一部分被删除或改变了汇档案中的所有价值,这样,申请将有许多预言,因此应当保护汇号。

例如,在DLL档案中储存。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签