dotnet-http-client

Configure .NET HTTP clients with IHttpClientFactory and resilience policies.

10|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-http-client
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-http-client
Source: https://github.com/AGIBuild/Agibuild.Fulora/tree/main/.cursor/skills/dotnet-http-client
Command: npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-http-client

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common pitfalls of managing HttpClient in .NET, preventing socket exhaustion and DNS staleness, and guiding users towards robust, resilient, and testable HTTP client implementations.

Core Features & Use Cases

  • IHttpClientFactory: Learn why and how to use it for efficient HTTP client management.
  • Named & Typed Clients: Implement strategies for consuming multiple APIs or encapsulating API logic.
  • Resilience: Integrate with Microsoft.Extensions.Http.Resilience for automatic retries, timeouts, and circuit breakers.
  • DelegatingHandlers: Build custom handlers for cross-cutting concerns like logging, authentication, and correlation ID propagation.
  • Testing: Strategies for unit and integration testing of HTTP clients and handlers.

Quick Start

Register a typed HTTP client for consuming a catalog API with standard resilience policies.

Frequently Asked Questions about dotnet-http-client

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent socket exhaustion when using HttpClient in .NET?

Prevent HttpClient socket exhaustion in .NET by using IHttpClientFactory to manage client lifetimes, ensuring proper socket reuse and avoiding DNS staleness in long-running applications.

What is the best way to configure resilience patterns for HTTP API calls in .NET?

The best way to configure resilience for .NET HTTP API calls is using Microsoft.Extensions.Http.Resilience, which provides automatic retries, timeouts, and circuit breakers when consuming APIs via IHttpClientFactory.

How do I add custom authentication or logging to a typed HttpClient?

Add custom authentication or logging to a typed HttpClient by implementing DelegatingHandler chains, which intercept requests to inject cross-cutting concerns like correlation IDs before the response returns.

Should I use named or typed clients with IHttpClientFactory?

Use typed clients with IHttpClientFactory to encapsulate API logic within a dedicated class, or use named clients when consuming multiple distinct APIs requiring different configurations within the same application.

How do I unit test an API client that uses IHttpClientFactory?

Unit test an API client using IHttpClientFactory by mocking the underlying HTTP transport, verifying that your DelegatingHandler chains and typed client logic correctly process the returned HTTP responses.

Why does my .NET HttpClient experience stale DNS changes?

HttpClient experiences stale DNS changes because its underlying handler caches DNS entries; using IHttpClientFactory rotates handler instances automatically to refresh DNS records and prevent connection failures.