-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
My config at Startup.cs
services.AddDbContext<TradeBotDbContext>(ServiceLifetime.Transient);
services.AddCap(cap =>
{
cap.UseEntityFramework<TradeBotDbContext>();
cap.UseRabbitMQ(Configuration["CAP:RabbitMQ:HostName"]);
});
services.AddTransient<ICapPublisher, CapPublisher>();
services.AddMvc();
services.AddSingleton<IHostedService, TradeBotService>();Then, Just simply call this in the Service
await CapPublisher.PublishAsync("test", new { Message = "Hello World" });
And it throws the exception The transaction operation cannot be performed because there are pending requests working on this transaction. sometimes.
It throws here:
private void ClosedCap()
{
if (IsCapOpenedTrans)
{
DbTransaction.Commit(); // THROW WHEN CALLING HERE
DbTransaction.Dispose();
}
if (IsCapOpenedConn)
DbConnection.Dispose();
}I'm using SQL Server on Linux as the storage
UPDATED:
Trying with the Postgres and it says:
A command is already in progress: INSERT INTO Cap.[Published] ([Name],[Content],[Retries],[Added],[ExpiresAt],[StatusName])VALUES(@Name,@Content,@Retries,@Added,@ExpiresAt,@StatusName)