After deploy the asp.net web api application, I found that when a error (exception) occurs, the return message would only be
But when in local debug, the message would be more detail:
Theoretically, you should not show those detail information to your final user, no matter for detail code security, or user experience.
But when debugging our cloud service after deploying, we may need to figure out what happened in backend.
In fact, ASP.NET web api has a separate configuration for how the error detail is shown in different environments.
HttpConfiguration, there is a property called
IncludeErrorDetailPolicy. Let’s check its possible value.
Its comments has already show the detail, so for my case:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please refer to the author's name `winterTTr` when you remix, transform, and build upon this material.
winterTTr创作，采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。修改，参照或者转载请注明作者