I am using CompressResponse on a service that is called by browser client as well as another internal service. The other internal service has headers to spit out an excel file [AddHeader(ContentType = “application/vnd.ms-excel”)]
I am getting a 405 Not Supported Error code when calling the [Compress]'ed service through the gateway.
Removing [Compress] allows it to work. I assume instantiating the service and calling Any(requestDTO) would work as well but neither of those seem optimal?
I think I’ve got everything at myget 5.4.1 in the solution, but am still getting the error.
2019-03-22 21:21:49.104 :ERROR:Service Ex System.AggregateException: One or more errors occurred. (ContentType not supported ‘application/vnd.ms-excel’) —> System.NotSupportedException: ContentType not supported ‘application/vnd.ms-excel’
at ServiceStack.Host.ContentTypes.SerializeUnknownContentType(IRequest req, Object response, Stream stream)
— End of inner exception stack trace —
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at ServiceStack.Host.ContentTypes.SerializeToString(IRequest req, Object response)
at ServiceStack.CompressResponseAttribute.ExecuteAsync(IRequest req, IResponse res, Object response)
at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto)
—> (Inner Exception #0) System.NotSupportedException: ContentType not supported ‘application/vnd.ms-excel’
at ServiceStack.Host.ContentTypes.SerializeUnknownContentType(IRequest req, Object response, Stream stream)<—
var rv = new getProductRequestResponse();
The response of the outer service is a memory stream from a NOPI document - but we aren’t getting that far. It feels like the inner service is assuming we’re on HTTP and picking up the headers applied to the outer service’s method. It’s failing on the gateway.send(reqdto)
Service1 has content type header and returns a memory stream.
Service2 returns poco dto but has the compress attribute
Service1 Calls Service2 and fails with 405 if the compress attribute is on service2… ok if not.