Επεξεργασία

Κοινή χρήση μέσω


HttpRequestMessage.Version Property

Definition

Gets or sets the HTTP message version.

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

Property Value

The HTTP message version. The default value is 1.1, unless you're targeting .NET Core 2.1 or 2.2. In that case, the default value is 2.0.

Remarks

In .NET Core, the default message version differs based on the version you're using. .NET Core 2.1 changed the default value from 1.1 to 2.0. In .NET Core 3.0, the default value was reverted back to 1.1.

.NET Framework

The default message version is 1.1.

.NET Core

The following table lists the default message version based on the version of .NET Core:

.NET Core version HTTP request version
2.1
2.2
2.0
Any other .NET Core version 1.1

Applies to