什么是 CLR 托管?
什么是 CLR 托管?其用途是什么?
What is CLR hosting? What is the use case for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
什么是 CLR 托管?其用途是什么?
What is CLR hosting? What is the use case for that?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
有关与 CLR v2 (. NET 2.0、3.0 和 3.5)。有关 .NET 4.0 中较新的 CLR 托管 API 的信息,请参阅此处。
基本上,CLR 充当可以由进程加载和“托管”的库。如果您愿意,您可以开发一个加载和托管 CLR 的应用程序;这将允许您的应用程序包含整个 CLR 虚拟机、加载程序集并在其中运行 .NET 托管代码。
例如,SQL Server 2008 就可以做到这一点。您可以编写存储在 SQL Server 数据库中并在 SQL Server 数据库引擎内运行的 .NET 代码。 SQL Server 托管 CLR 来实现这一目标。
Windows shell(通常的用户界面)之外的 CLR 主机可以为代码运行提供特定的上下文。这对于专门的应用程序或非常特殊的场景非常有用。 MSDN(上面的链接)有一些关于这些问题的指南。
See here for information about CLR hosting that was relevant for CLR v2 (.NET 2.0, 3.0 and 3.5). For information about the newer CLR Hosting API in .NET 4.0, see here.
Basically, the CLR acts as a library that can be loaded and "hosted" by a process. You can develop an app that loads and hosts the CLR if you wish; that would allow your app to contain a whole CLR virtual machine, load assemblies and run .NET managed code all within it.
SQL Server 2008, for example, can do this. You can write .NET code that is stored in a SQL Server database and run from within the SQL Server database engine. SQL Server is hosting the CLR to achieve that.
A CLR host other than the Windows shell (the usual user interface) can provide a specific context for your code to run. This can be useful for specialised applications or very particular scenarios. MSDN (link above) has some guidelines on these matters.
CLR 托管在您选择的进程中托管 .NET 公共语言运行时。
用例是现有环境不适合您的要求的情况。现有的一些环境有 ASP.NET、WinForms、Windows Workflow Foundation 等。如果这些不符合您的要求,您可以自行托管。
CLR Hosting is Hosting the .NET Common Language Runtime in a process of your choice.
The use case would be situations where existing environments don't suit your requirements. Some of the existing environments are ASP.NET, WinForms, Windows Workflow Foundation, etc. If these don't suit your requirements, you can host it yourself.
CLR 托管是使用 .NEt 应用程序的托管。当您在本机进程内启动 .NET 运行时时,该本机应用程序将成为运行时的主机。这使您可以将 .NET 功能添加到本机应用程序中。
如果运行时正在运行,但尚未加载任何用户代码。一些内部线程调度程序和垃圾收集器肯定正在运行,因为它们是 CLR 运行时的一部分
它比其他托管服务非常复杂。
CLR Hosting is Hosting uses .NEt application.When you start the .NET runtime inside a native process, that native application becomes a host for the runtime. This lets you add .NET capabilities to your native applications.
If the runtime is running, but it hasn't got any loaded user code yet. Some internal thread scheduler and garbage collector are surely running, because they are part of the CLR runtime
It is very complicated than other hosting services.