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

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

问题描述

我想知道如何在 .net core 中实现沙箱,因为 .net core 不支持应用程序域.此外,我无法使用 Virtualization 或 Docket 容器,因为这些东西在我的目标机器上不可用.

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 Core 文档,看起来您的选择有点有限.

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.

应用域

为什么停止使用? 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天全站免登陆