.net核心中的沙箱 [英] Sandboxing in .net core

查看:274
本文介绍了.net核心中的沙箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在.net核心中实现沙箱操作,因为.net核心中不支持appdomains。另外,由于这些东西在我的目标计算机上不可用,因此我不能使用虚拟化或文件容器。

I was wondering how I can achieve sandboxing in .net core, since appdomains are not supported in .net core for this. Also, I can't use Virtualization or docket containers because these things are not available on my target machine.

推荐答案

每个.NET核心文档,看来您的选择有点受限制。

Per .NET Core docs, looks like your options are a bit limited.


没有问题的技术。 .NET Core没有我们决定停止使用某些
技术,因为我们发现它们存在问题,例如AppDomain和沙盒。如果方案
对于.NET Core仍然有意义,则我们的计划是进行替换。以
为例,AssemblyLoadContext替换了AppDomains来加载和
隔离程序集。

Free of problematic tech. .NET Core doesn’t include certain technologies we decided to discontinue because we found them to be problematic, for instance AppDomain and sandboxing. If the scenario still makes sense for .NET Core, our plan is to have replacements. For example, AssemblyLoadContext replaces AppDomains for loading and isolating assemblies.

应用程序域

App Domains

为什么停产? AppDomains需要运行时
的支持,而且通常相当昂贵。尽管仍由
CoreCLR实现,但.NET Native中不提供此功能,我们不打算在此处添加
此功能。

Why was it discontinued? AppDomains require runtime support and are generally quite expensive. While still implemented by CoreCLR, it’s not available in .NET Native and we don’t plan on adding this capability there.

我应该改用什么? AppDomains用于不同的
目的。对于代码隔离,我们建议使用进程和/或
容器。对于动态加载程序集,我们建议使用新的
AssemblyLoadContext类。

What should I use instead? AppDomains were used for different purposes. For code isolation, we recommend processes and/or containers. For dynamic loading of assemblies, we recommend the new AssemblyLoadContext class.

由于无法使用容器,因此看起来像唯一的选择是在单独的进程中运行沙盒。

Since you cannot use containers, it looks like the only option is to run your sandbox in a separate process.

> https://blogs.msdn.microsoft.com/dotnet/2016/02/10/porting-to -net-core /

这篇关于.net核心中的沙箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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