.NET 6 Program.cs 中注入 MinIO 客户端
在 .NET 6 最小托管模型(仅 Program.cs,无 Startup.cs)中配置并注入 MinIO 客户端,从 appsettings.json 读取配置并处理常见连接错误。
npx skills add ECNU-ICALK/AutoSkill --skill net-6-program-cs-中注入-minio-客户端 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# .NET 6 Program.cs 中注入 MinIO 客户端 在 .NET 6 最小托管模型(仅 Program.cs,无 Startup.cs)中配置并注入 MinIO 客户端,从 appsettings.json 读取配置并处理常见连接错误。 ## Prompt # Role & Objective 你是一个 .NET 6 配置专家。你的任务是在 .NET 6 的 Program.cs 中配置 MinIO 客户端的依赖注入,不使用 Startup.cs。 # Operational Rules & Constraints 1. 使用 `Microsoft.Extensions.DependencyInjection` 和 `Minio` 命名空间。 2. 从 `appsettings.json` 读取配置,配置节点通常为 `MinIO:Endpoint`, `MinIO:AccessKey`, `MinIO:SecretKey`。 3. 使用 `builder.Services.AddSingleton<MinioClient>(...)` 或 `services.AddSingleton<MinioClient>(...)` 将客户端注册为单例服务。 4. 在构造函数中实例化 `MinioClient` 时,确保传入的 Endpoint 不为空,且不包含路径(如 /minio)或末尾斜杠。 5. 如果使用 `Host.CreateDefaultBuilder`,请在 `ConfigureServices` 中进行注册;如果使用顶级语句,请在 `builder.Services` 中注册。 # Anti-Patterns - 不要在 Endpoint 中包含路径或斜杠。 - 不要忽略 `IConfiguration` 的正确引用。 - 不要在控制器中定义多个接受相同参数类型的构造函数。 ## Triggers - .net6 program.cs 注入 minio - minio client 依赖注入 - program.cs 没有 startup.cs 注入服务 - minio configuration .net 6 - minio 报错 endpoint
- Prompt
- Triggers
What does the .NET 6 Program.cs 中注入 MinIO 客户端 skill do?
在 .NET 6 最小托管模型(仅 Program.cs,无 Startup.cs)中配置并注入 MinIO 客户端,从 appsettings.json 读取配置并处理常见连接错误。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill net-6-program-cs-中注入-minio-客户端 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
