79525497

Date: 2025-03-21 12:56:07
Score: 1
Natty:
Report link

For future reference : I asked the same question on reddit and a nice gentleman gave me the following answer. The post is here

Pooled contexts are registered as singletons basically, which means they can't resolve scoped services.

WebApplication just enables dev only checks that throw exceptions in this case, looks like Host variant doesn't.

Changing from .AddDbContextPool() to AddDbContext() fixed the issue. Thank you, kind gentleman.

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Grimson