什么是使用GAC中的优势和劣势?劣势、优势、GAC

2023-09-02 10:22:16 作者:那抹笑下的痛誰知

和最重要的是,是否有情况下,人们必须使用全局程序集缓存或其中一个不能用呢?

And on top of that, are there cases where one has to use the global assembly cache or where one cannot use it?

推荐答案

从海关总署装载组件意味着更少的开销和安全,您的应用程序将永远载入正确版本的.NET库 您不要NGEN是GAC之外的组件,因为会有几乎没有性能提升,在很多情况下,即使性能损失。 您已经使用GAC,因为所有的标准.NET程序集实际上是在海关总署和ngened(安装期间)。 使用GAC为自己的库增加了复杂性到部署,我会尽量避免它不惜一切代价。 您的用户需要登录的安装过程中的管理员,如果你想要把东西放到GAC中,相当多的问题,对于许多类型的应用程序。

Loading assemblies from GAC mean less overhead and security that your application will always load correct version of .NET library You shouldn't ngen assemblies that are outside of GAC, because there will be almost no performance gain, in many cases even loss in performance. You're already using GAC, because all standard .NET assemblies are actually in GAC and ngened (during installation). Using GAC for your own libraries adds complexity into deployment, I would try to avoid it at all costs. Your users need to be logged as administrators during installation if you want to put something into GAC, quite a problem for many types of applications.

所以,要总结这一切,从简单的开始,如果你在后面看到的主要的性能提升,如果你把你的程序集到GAC和NGEN他们,去为它,否则不要打扰。 GAC是更适合的框架那里是期望的库中之间更多的应用程序共享,在99%的情况下,你不需要它。

So to sum it all, start simple and if you later see major performance gains if you put your assemblies into GAC and NGEN them, go for it, otherwise don't bother. GAC is more suitable for frameworks where there is expectation for library to be shared among more applications, in 99% of cases, you don't need it.

 
精彩推荐
图片推荐