我在 Azure WebApp 中有一個 REST API。當 POST 發(fā)送到我的端點時,我會做一些檢查,如果需要,我會拋出一個 HttpException:throw new HttpException(400, msgInfo);msgInfo我的自定義消息在哪里。在我使用 Visual Studio 2015 的開發(fā)機器中,我的回答是:{"Message":"An error has occurred.","ExceptionMessage":"[my custom message]","ExceptionType":"System.Web.HttpException","StackTrace":"..."}現(xiàn)在我可以向用戶顯示有用的消息。但是在 Azure 上,響應只是:{"Message":"An error has occurred."}所以沒有自定義消息。這很可能是 Azure 中的設置。我知道它不應該顯示我的完整堆棧跟蹤,但它應該顯示ExceptionMessage.在我的Web.config我有:<system.web> <customErrors mode="RemoteOnly" /></system.web><system.webServer> <httpErrors errorMode="Detailed" /></system.webServer>如何解決這個問題?
- 1 回答
- 0 關注
- 190 瀏覽
添加回答
舉報
0/150
提交
取消