简体   繁体   中英

Web Api doesn't return exceptions

I have a Web Api implementation (version 2.2) that doesn't throw any errors in the test environment.

If I run this method in dev

[HttpGet]
public HttpResponseMessage Fail()
{
    return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "I shall fail", new Exception("Exception message"));
}

It returns as supposed

在此处输入图片说明

In the other environment I only get

{"Message":"I shall fail"}

Any ideas where to start looking?

设置为LocalonlyIncludeErrorDetailPolicy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM