Soenneker.DnsClient.Util 11.0.1306

Prefix Reserved
dotnet add package Soenneker.DnsClient.Util --version 11.0.1306
                    
NuGet\Install-Package Soenneker.DnsClient.Util -Version 11.0.1306
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.DnsClient.Util" Version="11.0.1306" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.DnsClient.Util" Version="11.0.1306" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.DnsClient.Util" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.DnsClient.Util --version 11.0.1306
                    
#r "nuget: Soenneker.DnsClient.Util, 11.0.1306"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.DnsClient.Util@11.0.1306
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.DnsClient.Util&version=11.0.1306
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.DnsClient.Util&version=11.0.1306
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.DnsClient.Util

Provides a lazily initialized, cached DnsClient.NET LookupClient through dependency injection.

Installation

dotnet add package Soenneker.DnsClient.Util

Registration

using Soenneker.DnsClient.Util.Registrars;

services.AddDnsClientUtilAsSingleton();

Use AddDnsClientUtilAsScoped() when each dependency-injection scope should own a separate lookup client and cache.

Query a record

using DnsClient;
using DnsClient.Protocol;
using Soenneker.DnsClient.Util.Abstract;

public sealed class AddressResolver(IDnsClientUtil dnsClientUtil)
{
    public async Task<IReadOnlyList<string>> Resolve(
        string host,
        CancellationToken cancellationToken)
    {
        LookupClient client = await dnsClientUtil.Get(cancellationToken: cancellationToken);
        IDnsQueryResponse response = await client.QueryAsync(
            host,
            QueryType.A,
            cancellationToken: cancellationToken);

        return response.Answers.ARecords()
                       .Select(record => record.Address.ToString())
                       .ToArray();
    }
}

Get returns the same LookupClient for the utility’s lifetime. The first successful call controls its options; options supplied to later calls are ignored.

Configure the client on the first call when system DNS defaults are not appropriate:

var options = new LookupClientOptions
{
    UseCache = true,
    Timeout = TimeSpan.FromSeconds(3),
    Retries = 2
};

LookupClient client = await dnsClientUtil.Get(options, cancellationToken);

For singleton registration, initialize it once during startup if multiple callers might otherwise race to provide different settings. DnsClient.NET handles DNS response codes and transport failures; inspect the returned response and allow cancellation or network exceptions to propagate when the caller should decide recovery behavior.

The utility owns the cached client. Do not dispose the returned LookupClient; dispose the utility or its dependency-injection scope instead.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.DnsClient.Util:

Package Downloads
Soenneker.Validators.Email.Mx

A validation module checking for the existence of domain MX records

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1306 139 11/11/2026
11.0.1305 121 11/11/2026
11.0.1304 88 11/11/2026
11.0.1303 103 11/11/2026
11.0.1302 87 11/11/2026
11.0.1301 449 11/3/2026
11.0.1300 182 10/27/2026
11.0.1299 140 10/26/2026
11.0.1297 109 10/26/2026
11.0.1296 111 10/26/2026
11.0.1295 134 10/26/2026
4.0.1294 128 10/25/2026
4.0.1293 167 10/15/2026
4.0.1292 125 10/15/2026
4.0.1291 115 10/14/2026
4.0.1290 137 10/14/2026
4.0.1289 98 10/14/2026
4.0.1288 102 10/14/2026
4.0.1287 112 10/14/2026
4.0.1286 105 10/14/2026
Loading failed

Updated Soenneker.Utils.AsyncSingleton to 11.0.893