0

when I try to call to Web Api from my .net core MVC project I received this error, Please help me to resolve this issue :

The DbContext of type 'ApplicationDbContext' cannot be pooled because it does not have a public constructor accepting a single parameter of type DbContextOptions or has more than one constructor.

1
  • here's a high voted question which reported the same error message. pls take a look at them. If the solutions in this question didn't help you, pls provide more details to help us reproduce the issue at least. Commented Oct 25, 2022 at 1:54

1 Answer 1

2

Actually, I had two constructors in my DbContext class like below.

 public ApplicationDbContext()
        {

        }
 public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
        {
            // ProxyCreationEnabled = false;
            // Configuration.LazyLoadingEnabled = false;
        }

when I remove the parameterless constructor, the issue was fixed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.