dotnetcore/CAP · error · InvalidOperationException
You must be config storage provider for…
Error message
You must be config storage provider for CAP!
===================================================================================
======== eg: services.AddCap( options => { options.UseSqlServer(...) }); ========
=================================================================================== What it means
Error "You must be config storage provider for CAP! =================================================================================== ======== eg: services.AddCap( options => { options.UseSqlServer(...) }); ======== ===================================================================================" thrown in dotnetcore/CAP.
Solutions
- Configure a storage provider in AddCAP, e.g. services.AddCAP(options => { options.UseSqlServer(connectionString); }); (or UseMySql/UsePostgreSql/UseMongoDB/etc.).
- Ensure the storage extension package (e.g. DotNetCore.CAP.SqlServer) is installed and the Use* method is actually invoked inside the AddCAP options lambda.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/DotNetCore.CAP/Internal/IBootstrapper.Default.cs:146 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dotnetcore/CAP@e52b8508e5 (2026-09-14).
Data as JSON: /api/errors/ef15a05bb06ab884.
Report an issue: GitHub.
Appendix: source
Thrown at src/DotNetCore.CAP/Internal/IBootstrapper.Default.cs:146
{
var marker = _serviceProvider.GetService<CapMarkerService>();
if (marker == null)
throw new InvalidOperationException(
"AddCap() must be added on the service collection. eg: services.AddCap(...)");
var messageQueueMarker = _serviceProvider.GetService<CapMessageQueueMakerService>();
if (messageQueueMarker == null)
throw new InvalidOperationException(
"You must be config transport provider for CAP!" + Environment.NewLine +
"==================================================================================" +
Environment.NewLine +
"======== eg: services.AddCap( options => { options.UseRabbitMQ(...) }); ========" +
Environment.NewLine +
"==================================================================================");
var databaseMarker = _serviceProvider.GetService<CapStorageMarkerService>();
if (databaseMarker == null)
throw new InvalidOperationException(
"You must be config storage provider for CAP!" + Environment.NewLine +
"===================================================================================" +
Environment.NewLine +
"======== eg: services.AddCap( options => { options.UseSqlServer(...) }); ========" +
Environment.NewLine +
"===================================================================================");
}
public ValueTask DisposeAsync()
{
Dispose();
return ValueTask.CompletedTask;
}
}View on GitHub (pinned to e52b8508e5)