HttpClientHandler.AutomaticDecompression 屬性

定義

取得或設定解壓縮方法的類型,此為 HTTP 內容回應的自動解壓縮處理常式所使用。

public:
 property System::Net::DecompressionMethods AutomaticDecompression { System::Net::DecompressionMethods get(); void set(System::Net::DecompressionMethods value); };
public System.Net.DecompressionMethods AutomaticDecompression { get; set; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public System.Net.DecompressionMethods AutomaticDecompression { get; set; }
member this.AutomaticDecompression : System.Net.DecompressionMethods with get, set
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.AutomaticDecompression : System.Net.DecompressionMethods with get, set
Public Property AutomaticDecompression As DecompressionMethods

屬性值

處理常式所使用的自動解壓縮方法。

屬性

備註

自動解壓縮僅適用于最上層壓縮。 因此,如果內容多次壓縮,則只會解壓縮最後一個壓縮。 例如,針對包含標頭的回應 Content-Encoding: gzip, br ,其標頭會先使用 gzip 壓縮內容,然後使用 Brotli 壓縮內容,只使用 Brotli 解壓縮內容,將仍然壓縮的內容保留在 中 Content

將自動解壓縮設定為 以外的 None 任何專案,會導致將標頭與 set 值新增 Accept-Encoding 至每個傳出 HttpRequestMessage

針對全域組件快取 (GAC) 中的 .NET Framework 4.x System.Net.Http 二進位檔,預設值為 None

System.Net.Http 使用 NuGet 套件v4.1.0 至 v4.3.2 時,預設值為 GZipDeflate

NuGet 套件 v4.3.2 之後,會使用 的 None 預設值。

適用於