0
我在執行錯誤的Web-API的WebAPI控制器錯誤處理
[HttpGet]
public UserAccount Get()
{
throw new HttpResponseException(
new HttpResponseMessage(HttpStatusCode.InternalServerError)
{
Content = new StringContent("My Error Message"),
ReasonPhrase = "Critical Exception"
});
}
處理當我試圖從我的機器調用此方法(站點本地託管)一個問題,它是按預期工作。即我收到了錯誤信息(純文本)。但是當我從另一臺機器(連接局域網)訪問相同的URL時,響應是IIS 500內部錯誤頁面。這裏我的問題是,我沒有得到自定義錯誤消息「我的錯誤消息」
有什麼建議嗎?
固定...謝謝哥們 – Bibin 2013-03-18 10:35:15