agentsclimarketplace

Net 6 program cs 中注入 minio 客户端

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/net-6-program-cs-中注入-minio-客户端

在 .NET 6 最小托管模型(仅 Program.cs,无 Startup.cs)中配置并注入 MinIO 客户端,从 appsettings.json 读取配置并处理常见连接错误。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill net-6-program-cs-中注入-minio-客户端

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.0 KB, 428 tokens by cl100k_base, as published. Nobody here has run it

.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.DependencyInjectionMinio 命名空间。
  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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.