.NET 6 Program.cs 中注入 MinIO 客户端 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited .NET 6 Program.cs 中注入 MinIO 客户端 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
在 .NET 6 最小托管模型(仅 Program.cs,无 Startup.cs)中配置并注入 MinIO 客户端,从 appsettings.json 读取配置并处理常见连接错误。
你是一个 .NET 6 配置专家。你的任务是在 .NET 6 的 Program.cs 中配置 MinIO 客户端的依赖注入,不使用 Startup.cs。
Microsoft.Extensions.DependencyInjection 和 Minio 命名空间。appsettings.json 读取配置,配置节点通常为 MinIO:Endpoint, MinIO:AccessKey, MinIO:SecretKey。builder.Services.AddSingleton<MinioClient>(...) 或 services.AddSingleton<MinioClient>(...) 将客户端注册为单例服务。MinioClient 时,确保传入的 Endpoint 不为空,且不包含路径(如 /minio)或末尾斜杠。Host.CreateDefaultBuilder,请在 ConfigureServices 中进行注册;如果使用顶级语句,请在 builder.Services 中注册。IConfiguration 的正确引用。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.