简体   繁体   English

Web Api不返回异常

[英]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. 我有一个Web Api实现(版本2.2),在测试环境中不会引发任何错误。

If I run this method in dev 如果我在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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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