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.

適用於

另請參閱