共用方式為


<behaviors>

這個項目會定義兩個名稱為 endpointBehaviorsserviceBehaviors 的子集合。 每個集合會定義分別由端點和服務使用的行為項目。 每個行為項目都由其唯一的 name 屬性所識別。 從 .NET Framework 4 開始,繫結和行為都不需要有名稱。 如需預設組態和無名稱繫結與行為的詳細資訊,請參閱Simplified ConfigurationSimplified Configuration for WCF Services

結構描述階層

<system.serviceModel>

語法

<behaviors>
   <serviceBehaviors>
   </serviceBehaviors>
   <endpointBehaviors>
   </endpointBehaviors>
</behaviors>

屬性和元素

下列各節描述屬性、子項目和父項目。

屬性

項目子系

項目 描述

<endpointBehaviors>

這個組態區段表示為特定端點定義的所有行為。

<serviceBehaviors>

這個組態區段表示為特定服務定義的所有行為。

父項目

項目 描述

<system.serviceModel>

所有 Windows Communication Foundation (WCF) 組態項目的根項目。

備註

您可以使用 <remove> 項目移除集合中的特定行為。 若要這麼做,只需在 <remove> 項目的 name 屬性中提供要移除之行為的名稱。 您也可以使用 <clear> 項目來清除行為集合的所有內容,確保該行為集合在啟始時就是空的。

另請參閱

參考

BehaviorsSection
EndpointBehaviorElementCollection
EndpointBehaviorElement
ServiceBehaviorElementCollection
ServiceBehaviorElement

其他資源

Configuring and Extending the Runtime with Behaviors
Configuring Client Behaviors
Specifying Client Run-Time Behavior
Specifying Service Run-Time Behavior
Security Behaviors in WCF