HttpRequestMessageProperty.SuppressEntityBody 屬性


取得或設定值,這個值指出是否會忽略訊息的本文以及只傳送標頭。Gets or sets a value that indicates whether the body of the message is ignored and only the headers are sent.

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


如果要隱藏訊息本文則為 true,否則為 falsetrue if the message body is suppressed; otherwise, false. 預設為 falseThe default is false.


HttpRequestMessageProperty reqProps = new HttpRequestMessageProperty();
reqProps.SuppressEntityBody = false;
Dim reqProps As New HttpRequestMessageProperty()
reqProps.SuppressEntityBody = False


這個屬性會用於空白的訊息要求:例如,接受不含訊息本文之 GET 要求的服務。This property is used for empty message requests: for example, a service that accepts a GET request without a message body. 在這種情況下,當針對回應訊息建置 HttpRequestMessageProperty 物件時,請將 SuppressEntityBody 屬性設定為 trueIn this case, when building the HttpRequestMessageProperty object for the response message, set the SuppressEntityBody property to true.

與非 WCF 服務互通時,請務必注意,特定動詞應根據 HTTP 標準來包含訊息本文。其中包括 PUT 和 POST。When interoperating with non-WCF services, it is important to note that certain verbs are expected to contain a message body according to the HTTP standard; these include PUT and POST. 其他動詞則必須隱藏訊息本文,其中包括 GET 和 HEAD。Other verbs are expected to suppress the message body; these include GET and HEAD.