6.15HttpRemoteBuilder Builder

Created on Aug 17, 2026~1 min read

HttpRemoteBuilder is a builder used to configure and construct all the settings required by the IHttpRemoteService service. At application startup, these configurations are usually specified by calling the services.AddHttpRemote method.

The following shows all the configuration capabilities provided by HttpRemoteBuilder:

cs
services.AddHttpRemote(builder =>{    // Add custom content processors    builder.AddHttpContentProcessors(() => [ new CustomStringContentProcessor() ]);    // Add custom content converters    builder.AddHttpContentConverters(() => [ new SpanCharContentConverter() ]);    // Add custom generic content converters    builder.AddGenericHttpContentConverters(() => [ new(typeof(IAsyncEnumerable<>), typeArgs => (IHttpContentConverter)Activator.CreateInstance(typeof(AsyncEnumerableContentConverter<>).MakeGenericType(typeArgs[0]))!) ]);    // Set the custom object content converter factory    builder.UseObjectContentConverterFactory<CustomObjectContentConverterFactory>();    builder.UseObjectContentConverterFactory(typeof(CustomObjectContentConverterFactory));    // Add HTTP declarative services    builder.AddHttpDeclarative<IHttpService>();    builder.AddHttpDeclarative(typeof(IHttpService));   // Via the requireIHttpDeclarative parameter, supports registering declarative proxies that do not need to implement the IHttpDeclarative interface    // Batch-add HTTP declarative services    builder.AddHttpDeclaratives([typeof(IHttpService), typeof(IHttpService2), ...]);    // Scan assemblies to batch-add HTTP declarative services    builder.AddHttpDeclarativesFromAssemblies([ assembly1, assembly2, ... ]);  // If using the Furion framework, you can directly set App.Assemblies    // Add custom HTTP declarative extractors    builder.AddHttpDeclarativeExtractors(() => [ new AcceptDeclarativeExtractor() ]);    // Scan assemblies to batch-add HTTP declarative extractors    builder.AddHttpDeclarativeExtractorsFromAssemblies([ assembly1, assembly2, ... ]); // If using the Furion framework, you can directly set App.Assemblies    // Add HTTP request pipeline handler services    builder.AddPipelineHandler<CustomHttpRequestPipelineHandler>();    builder.AddPipelineHandler(typeof(CustomHttpRequestPipelineHandler));    // Set the custom logging service, which can be implemented by inheriting HttpRemoteLoggerBase    builder.UseLogger<CustomHttpRemoteLogger>();    builder.UseLogger(typeof(CustomHttpRemoteLogger));});