404 Status code not returned

There are instances when an error in the ServiceAPI will return an HTTP status 200, rather than one of the 400 status codes.  Unfortunately there are one or two cases where an internal exception falls outside of the standard error pipeline, this is something to be addressed in a future release.

A workaround

Any exception not handled will fall back to using a global error handler, at the moment this handler is not setting the status code, meaning it defaults to 200.  You can fix this yourself. To do this:

  1. go to the ServiceAPI server
  2. edit the file \RazorPages\GlobalErrors.cshtml
  3. add the code 'this.Response.StatusCode = 404;' into the header (see example below)


Given that this file does the layout for unhandled errors you can make other modifications to it as well, if you want it to fit into your site design.