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:
public class Startup
public void Configuration(IAppBuilder app)
var config = new HttpConfiguration
IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always // Add this line to enable detail mode in release