1

I have a service written using servicestack v3.9. I am trying to return a large result set and am getting an 500 internal server error on my client. If I look at the details of the error I see the results are listed in the exception but are truncated after 65536 characters. I know this is a default limit imposed by .net. What I don't know is how to increase it for service stack.

My client isn't connecting to the service using a binding in the web config since it's using service stack. For web api calls this seems like where you would fix this issue be increasing maxReceivedMessageSize in the binding. I am guessing there is some way to increase this limit for service stack too??

Ben Tidman
  • 2,129
  • 17
  • 30

1 Answers1

1

ServiceStack doesn't impose any limits or quota's itself, so any limits your Services hit are IIS/ASP.NET's which can be increased the same as any other ASP.NET Web Application.

The Web.Config example configuration below shows how to increase the request limit to 1GB in both IIS6 and IIS7:

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>

For IIS7 and above, you also need to add the lines below:

 <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>
mythz
  • 141,670
  • 29
  • 246
  • 390
  • Thanks for the answer. I have added this to both my web configs (client, and service) and I am still getting the same issue. Do you have any other suggestions? I am sure that my service is working. If I call the same service with parameters that return a smaller result set everything works. Big result set gives internal server error. See callstack added to question. – Ben Tidman Dec 11 '14 at 17:36
  • @BenTidman The client stack trace isn't helpful, it's just says the Service threw an exception. It would be more useful to provide the raw HTTP Response (i.e. using something like Fiddler or WebInspector). You basically need to find out which quota was exceeded to workout which ASP.NET configuration needs updating. – mythz Dec 11 '14 at 17:44
  • Trying to use fiddler and failing. I see the ajax request I am making from browser to web app. Request is not showing for web app to service. What am I doing wrong? Everything is running in local debug mode through vs. Does that mean request is not reaching level that Fiddler would pick up? – Ben Tidman Dec 11 '14 at 18:21
  • @BenTidman Look at how to [Configure .NET Applications to use Fiddler](http://docs.telerik.com/fiddler/configure-fiddler/tasks/ConfigureDotNETApp). – mythz Dec 11 '14 at 18:32
  • Took your advice and have narrowed down the issue further. Plz see edit to see if you can help further. Thanks – Ben Tidman Dec 11 '14 at 20:55
  • @BenTidman Ask a new question as this doesn't have anything to do with the original question. For future Q's make sure you include all relevant info in identifying the issue, as this was impossible to determine otherwise. – mythz Dec 11 '14 at 21:05
  • Done, if you wish to continue helping plz see: http://stackoverflow.com/questions/27432418/service-stack-datetime-conversion-error-when-serializing – Ben Tidman Dec 11 '14 at 21:12
  • @BenTidman Only thing I'd suggest is converting it to UTC in the DTO or return formatted as a string. – mythz Dec 11 '14 at 21:18