2

EDIT: I mis-diagnosed the exception. It was from a WCF client call in my Web API controller, not from the Web API client. Easy to fix by setting the maxReceivedMessageSize in my WCF client binding config.

I am exceeding the maximum message size in Web API. I can find how to configure it in WCF and in self-hosted Web API, but I can't find where to configure it in IIS hosted Web API.

Here is the exception:

CommunicationException The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize prop
erty on the appropriate binding element. Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
Server stack trace:
   at System.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()
   at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
   at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(HttpRequestMessage httpRequestMessage, Exception& requestException)
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
   at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Where can I access the the Web API binding settings so I can set the MaxReceivedMessageSize?

0

1 Answer 1

2

Your post is confusing...your exception is related to WCF self host but your question is about IIS hosted application...they both are different...anyways here are the options for both hosts:

  1. Selfhost: you can find the MaxReceivedMessageSize setting on HttpSelfhostConfiguration

  2. Webhost: You need to make couple of settings in case of this. You can take a look at my reply here for this: https://stackoverflow.com/a/17324840/1184056

Sign up to request clarification or add additional context in comments.

1 Comment

Actually, the exception is for a WCF client... I mis-diagnosed on my first pass of the production logs, but your comment in your answer got me turned in the right direction, so I just needed to set the maxReceivedMessageSize in the client binding config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.