CallbackDebugBehavior 類別

定義

啟用 Windows Communication Foundation (WCF) 回呼物件的服務偵錯。

public ref class CallbackDebugBehavior : System::ServiceModel::Description::IEndpointBehavior
public class CallbackDebugBehavior : System.ServiceModel.Description.IEndpointBehavior
type CallbackDebugBehavior = class
    interface IEndpointBehavior
Public Class CallbackDebugBehavior
Implements IEndpointBehavior
繼承
CallbackDebugBehavior
實作

範例

下列程式碼範例顯示用戶端組態檔,指示 WCF 從 SOAP 訊息中的用戶端回呼物件傳回 Managed 例外狀況資訊。

  <client>
      <endpoint 
        address="http://localhost:8080/DuplexHello" 
        binding="wsDualHttpBinding"
        bindingConfiguration="WSDualHttpBinding_SampleDuplexHello"
        contract="SampleDuplexHello" 
        name="WSDualHttpBinding_SampleDuplexHello"
        behaviorConfiguration="enableCallbackDebug">
      </endpoint>
  </client>
<behaviors>
  <endpointBehaviors>
    <behavior name="enableCallbackDebug">
      <callbackDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </endpointBehaviors>
</behaviors>

備註

透過應用程式組態檔或以程式設計方式,將 IncludeExceptionDetailInFaults 屬性設定為 true,讓用戶端回呼物件中的 Managed 例外狀況資訊流動回到服務,以供偵錯之用。

警告

將 Managed 例外狀況資訊傳回服務可能導致安全性風險,因為例外狀況詳細資料會公開未授權的服務可使用的內部用戶端實作相關資訊。 此外,雖然也能以程式設計方式設定 CallbackDebugBehavior 屬性,不過在部署時很容易會忘記停用 IncludeExceptionDetailInFaults

由於牽涉到安全性議題,我們強烈建議您:

如需與 Managed 例外狀況資訊相關的安全性問題詳細資訊,請參閱 在合約和服務中指定及處理錯誤

您也可以在用戶端應用程式組態檔中使用< callbackDebug >元素來設定此屬性的值。

建構函式

CallbackDebugBehavior(Boolean)

初始化 CallbackDebugBehavior 類別的新執行個體。

屬性

IncludeExceptionDetailInFaults

取得或設定值,這個值控制用戶端回呼物件是否將 SOAP 錯誤中的 Managed 例外狀況資訊傳回給服務。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

IEndpointBehavior.AddBindingParameters(ServiceEndpoint, BindingParameterCollection)

實作 AddBindingParameters(ServiceEndpoint, BindingParameterCollection) 方法以支援這個行為。

IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint, ClientRuntime)

實作 ApplyClientBehavior(ServiceEndpoint, ClientRuntime) 以支援這個行為。

IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher)

實作 ApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher) 以支援這個行為。

IEndpointBehavior.Validate(ServiceEndpoint)

實作 Validate(ServiceEndpoint) 以支援這個行為。

適用於