Cannot access a disposed object in ASP.NET Core working with DbContext



Bump into this error and found out the reason you cannot spin up a task to run a injected DbContext which normally injected by WebAPI dependency injection of a DbContext.

Solution

Create your dbcontext manually using code below (instead of using DbContext passed in the controller)







Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm