<generatePublisherEvidence > 元素<generatePublisherEvidence> Element

指定執行時間是否建立代碼啟用安全性(CAS) Publisher 辨識項。Specifies whether the runtime creates Publisher evidence for code access security (CAS).

<configuration> <configuration>
    <runtime >   <runtime>
     <generatePublisherEvidence >    <generatePublisherEvidence>

語法Syntax

<generatePublisherEvidence    
   enabled="true|false"/>  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.

屬性Attributes

屬性Attribute 描述Description
enabled 必要屬性。Required attribute.

指定執行時間是否建立 Publisher 辨識項。Specifies whether the runtime creates Publisher evidence.

啟用屬性enabled Attribute

Value 描述Description
false 不會建立 Publisher 辨識項。Does not create Publisher evidence.
true 建立 Publisher 辨識項。Creates Publisher evidence. 這是預設值。This is the default.

子項目Child Elements

無。None.

父項目Parent Elements

項目Element 描述Description
configuration 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有關執行階段初始化選項的資訊。Contains information about runtime initialization options.

備註Remarks

注意

在 .NET Framework 4 和更新版本中,這個元素不會影響元件載入時間。In the .NET Framework 4 and later, this element has no effect on assembly load times. 如需詳細資訊,請參閱安全性變更中的「安全性原則簡化」一節。For more information, see the "Security Policy Simplification" section in Security Changes.

Common language runtime (CLR)會在載入時嘗試驗證 Authenticode 簽章,以建立元件 Publisher 辨識項。The common language runtime (CLR) tries to verify the Authenticode signature at load time to create Publisher evidence for the assembly. 不過,根據預設,大部分的應用程式都不需要 Publisher 辨識項。However, by default, most applications do not need Publisher evidence. 標準 CAS 原則不依賴 PublisherMembershipConditionStandard CAS policy does not rely on the PublisherMembershipCondition. 除非您的應用程式是在具有自訂 CAS 原則的電腦上執行,或想要滿足部分信任環境中 PublisherIdentityPermission 的需求,否則您應該避免與驗證發行者簽章相關聯的不必要啟動成本。You should avoid the unnecessary startup cost associated with verifying the publisher signature unless your application executes on a computer with custom CAS policy, or is intending to satisfy demands for PublisherIdentityPermission in a partial-trust environment. (在完全信任環境中,身分識別許可權的需求一律會成功)。(Demands for identity permissions always succeed in a full-trust environment.)

注意

我們建議服務使用 <generatePublisherEvidence> 元素來改善啟動效能。We recommend that services use the <generatePublisherEvidence> element to improve startup performance. 使用這個元素也有助於避免延遲,這可能會造成超時和取消服務啟動。Using this element can also help avoid delays that can cause a time-out and the cancellation of the service startup.

組態檔Configuration File

這個元素只能用在應用程式佈建檔中。This element can be used only in the application configuration file.

範例Example

下列範例示範如何使用 <generatePublisherEvidence> 專案來停用應用程式的 CAS 發行者原則檢查。The following example shows how to use the <generatePublisherEvidence> element to disable checking for CAS publisher policy for an application.

<configuration>  
    <runtime>  
        <generatePublisherEvidence enabled="false"/>  
    </runtime>  
</configuration>  

請參閱See also