Go Back

Asp.Net Core EF Core Error: Cannot access a disposed of the object. A common cause of this error is disposing of a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing of context instances.

Sent 898 days ago 11/7/2021 8:35:39 AM

Hello Folks,

Another possibility that triggered this error in Asp.net 6 is when you call the Async Function without an "await" keyword, after the main Controller Function has been executed, the call to an Async function with API Logic is never awaited, resulting in this error.

One way to solve this issue is by using an "await" directive everywhere you don't want this error to be thrown.

I hope this helps you.
Leave feedback here stating how you resolved the error. No need to log in.

Sent 898 days ago 11/7/2021 8:42:52 AM


© 2024 - ErnesTech - Privacy
E-Commerce Return Policy