1

I am getting a webapi HttpError from my application, which is expected, but its missing the exceptionMessage, exceptionType and stacktrace properties

Here is the odd part - If I run my app locally (windows 8, IIS) I see the the missing properties in the response:

{ message: "An error has occurred." exceptionMessage: "unable to continue." exceptionType: "System.ApplicationException" stackTrace: null }

Now when I build the app and deploy it to our test server (windows server 2008 r2), here is the response:

{ message: "An error has occurred." }

I have compared IIS locally and on the test server, but I am not seeing any differences. I also made sure that we were running the same version of .net.

Any ideas?

mrvllus
  • 149
  • 2
  • 12
  • I created an HttpError() and returned it via Request.CreateErrorResponse and I was able to see the the exceptionMessage through. It seems like an IIS setting that is filtering those HttpError properties – mrvllus Sep 25 '15 at 18:35
  • Are you deploying application on test server in release or debug mode? – Pankaj Kapare Sep 25 '15 at 21:04

1 Answers1

1

I had add this line to my webapiconfig:

config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

HTTPError Exception Message not displaying when webapi is run on Server vs being run locally

Community
  • 1
  • 1
mrvllus
  • 149
  • 2
  • 12
  • I had a look at this but I would recommend against this solution as it also sends a full stack trace in the error detail. That is the sort of thing you don't really want in a production system. – Quango Apr 18 '16 at 16:05