AppDomainSetup.PartialTrustVisibleAssemblies 属性

定义

获取或设置标有 NotVisibleByDefault 标志的程序集的列表,这些程序集对沙盒应用程序域中运行的部分信任代码可见。Gets or sets a list of assemblies marked with the NotVisibleByDefault flag that are made visible to partial-trust code running in a sandboxed application domain.

public:
 property cli::array <System::String ^> ^ PartialTrustVisibleAssemblies { cli::array <System::String ^> ^ get(); void set(cli::array <System::String ^> ^ value); };
public string[] PartialTrustVisibleAssemblies { get; set; }
member this.PartialTrustVisibleAssemblies : string[] with get, set
Public Property PartialTrustVisibleAssemblies As String()

属性值

String[]

部分程序集名称的数组,其中每个部分名称都由简单程序集名称和公钥组成。An array of partial assembly names, where each partial name consists of the simple assembly name and the public key.

注解

从 .NET Framework 4 开始, AllowPartiallyTrustedCallersAttribute 可以通过将 (APTCA) 特性设置 PartialTrustVisibilityLevel 为来进行条件 NotVisibleByDefaultBeginning with the .NET Framework 4, the AllowPartiallyTrustedCallersAttribute (APTCA) attribute can be made conditional by setting its PartialTrustVisibilityLevel property to NotVisibleByDefault. 标记为的 APTCA 程序集 NotVisibleByDefault 不能由部分受信任的代码使用,除非宿主应用程序允许它。An APTCA assembly that is marked with NotVisibleByDefault cannot be used by partially trusted code unless the host application allows it.

沙盒应用程序域的宿主允许应用程序域中的代码通过以下方式使用程序集:具有条件 APTCA 特性的程序集:创建一个包含每个程序集的简单名称和公钥的数组,并将该数组分配给此属性。The host of a sandboxed application domain allows code in the application domain to use assemblies with conditional APTCA attributes by creating an array that contains the simple name and public key of each assembly, and assigning the array to this property. 例如,数组的元素可能如下所示: "MyAssembly,PublicKey = 0024000004800000940000000602000000240000525341310004000001000100db2ad5e5fedc67ea526ff72ad426ef68e08e241d296c499eedfec6648dcc62b1a12f72be5833a45bbec481b68415b08a5fbc9f9ef247b523dd72bbea65bb532784ddc5c704544bd2f1c2d46fdbe41e4f949e76f9947357b2d5cf8ca9f970701bbd6e8ab64ad31b20ad0be9b56dae4f6b83332b92a2a3 b8ea2804c40efbc0b6b9"。For example, an element of the array might look like the following: "MyAssembly, PublicKey=0024000004800000940000000602000000240000525341310004000001000100db2ad5e5fedc67ea526ff72ad426ef68e08e241d296c499eedfec6648dcc62b1a12f72be5833a45bbec481b68415b08a5fbc9f9ef247b523dd72bbea65bb532784ddc5c704544bd2f1c2d46fdbe41e4f949e76f9947357b2d5cf8ca9f970701bbd6e8ab64ad31b20ad0be9b56dae4f6b83332b92a2a3b8ea2804c40efbc0b6b9".

重要

如果你使用的是的子类 AppDomainManager ,并且定义它的程序集依赖于标记有条件 APTCA 特性的程序集,则你必须将这些程序集包含在你传递给 PartialTrustVisibleAssemblies AppDomainSetup 用来创建应用程序域的属性的列表中。If you are using a subclass of AppDomainManager, and the assembly that defines it depends on assemblies that are marked with the conditional APTCA attribute, you must include those assemblies in the list that you pass to the PartialTrustVisibleAssemblies property of the AppDomainSetup you use to create application domains. 否则,将禁用用条件 APTCA 特性标记的程序集。Otherwise the assemblies that are marked with the conditional APTCA attribute will be disabled.

备注

调试在沙盒应用程序域中运行的应用程序时,某些 SecurityException 消息可能会产生误导。When you are debugging an application that is running in a sandboxed application domain, some SecurityException messages can be misleading. 例如,消息可能表明,一个完全受信任的程序集只有有限的权限,当问题的真正原因在于,超过沙盒应用程序域的授予集的安全要求已传播到沙盒应用程序域的边界,并且失败。For example, a message might state that one of your fully trusted assemblies has only limited permissions, when the real cause of the problem is that a security demand that exceeds the grant set of the sandboxed application domain has propagated to the boundary of the sandboxed application domain and failed.

适用于

另请参阅