My Web Api, when launched locally (in Release mode), will return any errors in this format:
{ "Message": "An error has occurred.", "ExceptionMessage": "No text specified", "ExceptionType": "System.Exception", "StackTrace": null }
But after deploying / publishing to Azure VM, only the following remains:
{ "Message": "An error has occurred." }
API Code:
try { var msg = ... new MessageService().SaveMessage(msg)); // <-- does some checks; may throw. return Ok(); } catch (Exception ex) { return InternalServerError(ex); }
I would like this to be more detailed on Azure as a local result.
Could this be achieved, and if so, how?
I already (temporarily) deleted <compilation xdt:Transform="RemoveAttributes(debug)" /> from the <system.web> part of Web.Release.config, and then redeployed, but that didn't matter.
Or am I using the wrong approach / pattern?
Obviously, technical details should be limited, but right now we are not getting any details.
exception-handling asp.net-web-api azure
Peter B
source share