ServiceBehaviorAttribute.ValidateMustUnderstand Property


取得或設定值,這個值會指定系統或應用程式是否會強制執行 SOAP MustUnderstand 標頭處理。Gets or sets a value that specifies whether the system or the application enforces SOAP MustUnderstand header processing.

 property bool ValidateMustUnderstand { bool get(); void set(bool value); };
public bool ValidateMustUnderstand { get; set; }
member this.ValidateMustUnderstand : bool with get, set
Public Property ValidateMustUnderstand As Boolean

Property Value


如果系統要執行 SOAP 標頭 true 處理,則為 MustUnderstand,否則為 false,表示應用程式會執行這項處理。true if the system is to perform SOAP header MustUnderstand processing; otherwise false, which indicates that the application performs this processing. 預設值是 trueThe default value is true.


使用 ValidateMustUnderstand 屬性,即可關閉對抵達之訊息標頭的強制驗證。Use the ValidateMustUnderstand property to turn off the enforced validation of arriving message headers. 在正常的執行過程中,訊息標頭會與 UnderstoodHeaders 屬性進行比較,以確認服務已明確地處理抵達的標頭。In normal execution, message headers are compared against the UnderstoodHeaders property to confirm that arriving headers are explicitly handled by the service. 將此屬性設定為 false,即可停用這項檢查。Set this to false to disable this checking. 如果是設定為 false,應用程式就必須檢查標示為 MustUnderstand="true" 的標頭,並在無法瞭解其中一或多個標頭時傳回錯誤。When set to false, the application must check for headers marked with MustUnderstand="true" and return a fault if one or more of them were not understood. 當應用程式應該接受任何傳入的 SOAP 訊息 (例如,使用具型別或不具型別的訊息時) 以及執行自訂標頭處理時,這種設定會十分有用。This is useful when the application is supposed to accept any incoming SOAP messages (for example, when using typed or untyped messages) and perform custom header processing.

Applies to