ServiceStack maxReceivedMessageSize

302 Views Asked by At

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??

1

There are 1 best solutions below

8
On BEST ANSWER

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>