ErrorResponse Exception

We encountered this exception out of the blue and can’t figure out how to solve it. Any ideas?


2016-03-22 12:45:01.7737 Error occured while Processing Request: Could not find Markdown page ‘ErrorResponse’ System.IO.InvalidDataException: Could not find Markdown page ‘ErrorResponse’
at ServiceStack.Formats.MarkdownFormat.SerializeToStream(IRequest request, Object response, Stream stream)
at ServiceStack.Host.ContentTypes.<>c__DisplayClass3.b__2(IRequest httpReq, Object dto, IResponse httpRes)
at ServiceStack.HttpResponseExtensionsInternal.WriteErrorToResponse(IResponse httpRes, IRequest httpReq, String contentType, String operationName, String errorMessage, Exception ex, Int32 statusCode)
at ServiceStack.ServiceStackHost.HandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
at ServiceStack.HostContext.RaiseAndHandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse response, Object result, ResponseSerializerDelegate defaultAction, IRequest request, Byte[] bodyPrefix, Byte[] bodySuffix)
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse httpRes, IRequest httpReq, Object result, Byte[] bodyPrefix, Byte[] bodySuffix)
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse httpRes, IRequest httpReq, Object result)
at ServiceStack.Validation.ValidationFilters.RequestFilter(IRequest req, IResponse res, Object requestDto)
at ServiceStack.ServiceStackHost.ApplyRequestFiltersSingle(IRequest req, IResponse res, Object requestDto)
at ServiceStack.ServiceStackHost.ApplyRequestFilters(IRequest req, IResponse res, Object requestDto)
at ServiceStack.Host.RestHandler.ProcessRequestAsync(IRequest httpReq, IResponse httpRes, String operationName) at ServiceStack.Formats.MarkdownFormat.SerializeToStream(IRequest request, Object response, Stream stream)
at ServiceStack.Host.ContentTypes.<>c__DisplayClass3.b__2(IRequest httpReq, Object dto, IResponse httpRes)
at ServiceStack.HttpResponseExtensionsInternal.WriteErrorToResponse(IResponse httpRes, IRequest httpReq, String contentType, String operationName, String errorMessage, Exception ex, Int32 statusCode)
at ServiceStack.ServiceStackHost.HandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
at ServiceStack.HostContext.RaiseAndHandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse response, Object result, ResponseSerializerDelegate defaultAction, IRequest request, Byte[] bodyPrefix, Byte[] bodySuffix)
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse httpRes, IRequest httpReq, Object result, Byte[] bodyPrefix, Byte[] bodySuffix)
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse httpRes, IRequest httpReq, Object result)
at ServiceStack.Validation.ValidationFilters.RequestFilter(IRequest req, IResponse res, Object requestDto)
at ServiceStack.ServiceStackHost.ApplyRequestFiltersSingle(IRequest req, IResponse res, Object requestDto)
at ServiceStack.ServiceStackHost.ApplyRequestFilters(IRequest req, IResponse res, Object requestDto)
at ServiceStack.Host.RestHandler.ProcessRequestAsync(IRequest httpReq, IResponse httpRes, String operationName)

We solved this by setting the Content-Type for the request; why did we receive this exception if we set the DefaultContentType in the HostConfig?

SetConfig(new HostConfig
{
DefaultContentType = MimeTypes.Json
});

Did you request it from a Browser? As browsers ask for HTML content type by default. The DefaultContentType only gets used when clients/user-agents don’t specify that they Accept a specific Content-Type.

The request was sent via Postman.

OK but what were the HTTP Headers sent with the request? The Accept HTTP Request Header is what clients use to request a specific Content-Type.