I have an MVC application that is running on IIS. I have created a custom exception filter handler that returns a custom JSON object. When I run it locally everything works correctly.
However, when I deploy it to IIS the correct HTTP Status Code is returned, but instead of getting my custom JSON object, I am getting a plain text response that says "Bad Request" or "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
In my web config, I have added:
<customErrors mode="Off" />
and
<httpErrors>
<clear />
</httpErrors>
Any suggestions would be greatly appreciated.
Thanks!
I found the solution. I needed to add errorMode = "Detailed to my httpErrors tag.
<httpErrors errorMode="Detailed">
<clear />
</httpErrors>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.