.NET Core中没有AppDomains!为什么? [英] No AppDomains in .NET Core! Why?

查看:504
本文介绍了.NET Core中没有AppDomains!为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft是否选择在.NET Core中不支持AppDomains的强烈原因?

Is there a strong reason why Microsoft chose not to support AppDomains in .NET Core?

AppDomains在构建可能需要长时间运行的服务器应用程序时特别有用在不关闭服务器的情况下,以一种优雅的方式更新服务器加载的程序集。

AppDomains are particularly useful when building long running server apps, where we may want to update the assemblies loaded by the server is a graceful manner, without shutting down the server.

如果没有AppDomains,我们如何在运行时间较长的服务器中替换程序集

Without AppDomains, how are we going to replace our assemblies in a long running server process?

AppDomains还为我们提供了一种隔离服务器代码不同部分的方法。例如,自定义Websocket服务器可以在主应用程序域中具有套接字代码,而我们的服务在辅助应用程序域中运行。

AppDomains also provide us a way to isolate different parts of server code. Like, a custom websocket server can have socket code in primary appdomain, while our services run in secondary appdomain.

如果没有AppDomains,则上述情况是不可能的。

Without AppDomains, the above scenario is not possible.

我可以看到一个论点,它可能涉及使用VMs Cloud概念来处理程序集更改,而不必承担AppDomains的开销。但这是微软的想法或说法吗?还是对于上述情况有特定的原因和替代方法?

I can see an argument that may talk about using VMs concept of Cloud for handling assembly changes and not having to incur the overhead of AppDomains. But is this what Microsoft thinks or says? or they have a specific reason and alternatives for the above scenarios?

推荐答案

.NETCore子集的目的是保持。 NET安装。而且容易移植。这就是为什么您可以在Windows和OSX上都运行Silverlight应用程序,而无需等待很长时间才能访问网页的原因。下载或安装完整的运行时和框架需要花费几秒钟的时间。

The point of the .NETCore subset was to keep a .NET install small. And easy to port. Which is why you can, say, run a Silverlight app on both Windows and OSX and not wait very long when you visit the web page. Downloading and installing the complete runtime and framework takes a handful of seconds, give or take.

将其保持在小尺寸不可避免地需要削减功能。远程处理在该列表上很高,非常昂贵。否则隐藏得很好,但是例如您可以看到委托不再具有功能性的BeginInvoke()方法。这也将AppDomain列在清单上,如果没有远程支持,您将无法在应用程序域中运行代码。因此,这完全是设计使然。

Keeping it small inevitably requires features to be cut. Remoting was very high on that list, it is quite expensive. Otherwise well hidden, but you can for example see that delegates no longer have a functional BeginInvoke() method. Which put AppDomain on the cut list as well, you can't run code in an app domain without remoting support. So this is entirely by design.

这篇关于.NET Core中没有AppDomains!为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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