3.60Configuring the HTTP Version

Created on Aug 17, 2026~1 min read

When making an HTTP remote request, the default HTTP protocol version used is 1.1. However, when accessing some third-party servers, these servers may validate the HTTP version (for example, requiring version 2.0). In that case, you can configure it in the following two ways:

  • Per-request setting
cs
HttpRequestBuilder.Post("https://furion.net/")    .SetVersion(HttpVersion.Version20); // Recommended    .SetVersion("1.2"); // Overloaded method    .SetVersion(new Version("1.2"));    // Overloaded method
  • Global configuration
cs
// Configure the default clientservices.AddHttpClient(string.Empty, client =>{    client.DefaultRequestVersion = HttpVersion.Version10;});// Configure a specific clientservices.AddHttpClient("weixin", client =>{    client.DefaultRequestVersion = HttpVersion.Version10;});