I'm happy to say that the solution posted by JamesNK fixed my problem. I was on the right track by changing MaxReceivedMessageSize but there were a few implementation details that I had done wrong. Namely, the double null-arguments when calling Routes.MapServiceRoute
with a custom ServiceHostFactory.
Safe to say, there were no error in the HttpClient that related to this issue.
All in all, problem solved. Here is how I did it.
RouteTable.Routes.MapServiceRoute<CacheResource, CacheServiceHostFactory>("cache", null, null);
public class CacheServiceHostFactory : HttpConfigurableServiceHostFactory
public override System.ServiceModel.ServiceHostBase CreateServiceHost(string constructorString, Uri baseAddresses)
var host = base.CreateServiceHost(constructorString, baseAddresses);
foreach (HttpEndpoint endpoint in host.Description.Endpoints)
endpoint.MaxReceivedMessageSize = 1024*1024;