.NET Quickstart Guide

Connect a .NET application to SILO with the MinIO .NET SDK.

MinIO SDK for .NET

SILO implements the S3-compatible server contract, so applications can use the upstream MinIO .NET SDK without a SILO-specific client fork. This guide uses the stable NuGet package and environment variables for credentials.

Install the package

From an existing .NET project, add the Minio package:

BASH
dotnet add package Minio

Configure the connection

Set the endpoint and credentials for your SILO deployment. Keep secrets outside source control.

BASH
export S3_ENDPOINT=127.0.0.1:9000
export S3_ACCESS_KEY=silo-admin
export S3_SECRET_KEY=replace-with-a-strong-secret
export S3_USE_SSL=false

S3_ENDPOINT is a host and optional port, without an http:// or https:// prefix. Set S3_USE_SSL=true when the endpoint serves TLS.

Create a bucket and upload an object

CSHARP
using Minio;
using Minio.DataModel.Args;

var endpoint = Environment.GetEnvironmentVariable("S3_ENDPOINT")
    ?? throw new InvalidOperationException("S3_ENDPOINT is required");
var accessKey = Environment.GetEnvironmentVariable("S3_ACCESS_KEY")
    ?? throw new InvalidOperationException("S3_ACCESS_KEY is required");
var secretKey = Environment.GetEnvironmentVariable("S3_SECRET_KEY")
    ?? throw new InvalidOperationException("S3_SECRET_KEY is required");
var useSsl = bool.TryParse(Environment.GetEnvironmentVariable("S3_USE_SSL"), out var ssl)
    && ssl;

var client = new MinioClient()
    .WithEndpoint(endpoint)
    .WithCredentials(accessKey, secretKey)
    .WithSSL(useSsl)
    .Build();

const string bucket = "dotnet-quickstart";
const string objectName = "hello.txt";
const string filePath = "hello.txt";

var exists = await client.BucketExistsAsync(
    new BucketExistsArgs().WithBucket(bucket));

if (!exists)
{
    await client.MakeBucketAsync(
        new MakeBucketArgs().WithBucket(bucket));
}

await client.PutObjectAsync(
    new PutObjectArgs()
        .WithBucket(bucket)
        .WithObject(objectName)
        .WithFileName(filePath)
        .WithContentType("text/plain"));

Console.WriteLine($"Uploaded {objectName} to {bucket}");

Create hello.txt, then run the project:

BASH
dotnet run

For ASP.NET Core dependency injection and additional operations, use the SDK’s current README. The maintained repository also contains simple and host-based example projects; review their target branch and package version before copying code into a pinned application.

Production checklist

  • Use TLS and verify the server certificate.
  • Load credentials from a secret manager or protected environment, not source code.
  • Grant the application only the bucket and object permissions it needs.
  • Pin and test the SDK version as part of the application’s dependency lifecycle.
  • Handle SDK exceptions, request cancellation, retries, and multipart-upload cleanup explicitly.

See Identity and Access Management for server-side policy configuration.