Web Api on Azure shows no error detail using 'return InternalServerError(ex)'
问题 My Web Api when run 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 deployment/publish to an Azure VM, only this 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