I am trying to have a service return a byte[]. However, I can see that the service GET call finishes, but the request never ends (both in Postman and in the browser). Am I setting this up correctly?
public object Get(GetReport request)
{
string mimeType = "application/pdf";
var bytes = _service.GetReport(request.Id);
return new HttpResult(bytes) { ContentType = mimeType };
}
Thanks,
Leeny
Thanks for the link.
I have now tried a simple one like this and it’s the same - Completes the return statement and the request just never seems to end. I do not have any code that is meant to run Post-Requests that I am aware of.
Thanks Demis. Can’t see any response headers as the request just stays as pending until I cancel it in Postman and the browser. Sometimes, in the browser, I get a 404 - Resource not found but this is after it hits and completes the return statement in the Get code.
I will keep digging but if you see something obvious, please let me know.
It’s because you’ve registered a conflicting HttpHandlerFactory. Please see the docs on Run side-by-side with another Framework with how to properly configure ServiceStack when hosted on a custom path e.g. it will work if you add the documented Web.config configuration:
My previous SessionHttpHandler had this in the ProcessRequest method to avoid redirection to the Login page when not authenticated.
However, when I add this line to ProcessRequest, I noticed that this line of code is not hit. Any ideas?
public void ProcessRequest(HttpContext context)
{
// This flag must be set to true so that 401 Unauthorized errors are not automatically redirected to a login url
context.Response.SuppressFormsAuthenticationRedirect = true;
Handler.ProcessRequest(context);
}