Receiving 400 on production, local env works fine
Hey,
I have same ASP.NET Core app running both on my localhost and on production (docker).
The only difference between the two are environment variables (aspnet env - release for prod and development for localhost).
When I run following powershell to call one of my endpoints:
The localhost goes through and production throws:
This is how my controller looks:
Any ideas why this is happening?
9 Replies
Tried setting following as well:
what's the actual response you get?
For localhost my business logic goes through and I return 204.
For production it seems I don't even enter the endpoint and it is being stopped by the MVC 400 handling.
Does that answer your question?
but what is the content of the response
when you get 400
it should contain something useful
When called from next.js app I get this in network response browser tab:
My request matches my DTO:
and you request is exactly the same?
in both scenario
i would enable more verbose logging in prod
might provide more clues
How can I enable more verbose logging for aspnet / mvc validation?
The thing is, I have Serilog enabled.
In my endpoint I log stuff, which doesn't get logged (stuff in Program.cs gets logged) so I assume, it doesnt even enter my endpoint.
In my Program.cs I do following:
Then in the endpoint it doesnt seem anything is logged. I have suspicion I actually enter the endpoint but inside I also return 400 after some other validation
.MinimumLevel.Debug() should do it
but asp net core middlewares log other stuff on their own, which should help