WFC problem

M

Marco Pais

Hi there.

I'm having a problem with a Web Service that I've created. This WS has
several simple methods, that are working fine... no problem with code.

However, when retieving a bigger number of rows, I get this error:

"The maximum message size quota for incoming messages (65536) has been
exceeded. To increase the quota, use the MaxReceivedMessageSize property on
the appropriate binding element. "

I then searched google for some help/explanation and I found this site,
amoung others:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1234670&SiteID=1

Initialy, my web config on the server is like this:
------------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation defaultLanguage="c#" />
</system.web>

</configuration>
------------------------

If I follow the instructions on that post, my WS returns error.

How can I configurate this??

Thanks in advance,

Marco
 
M

Marc Gravell

Are you sure that is your web.config? WCF typically has a LOT more
config than that (in system.ServiceModel), for either the client or the
server.

If your app is setting up the configuration through code (which is
entirely possible with WCF) then you need to find the bit of code that
configures the binding. Note that these quotas don't just apply to the
server; setting it at the server is useful for uploading larger arrays
etc, but the quotas may need to be independently set at the client if
the problem is the server *returning* too much data.

Marc
 
M

Marc Gravell

I've re-read your post, and indeed it looks like a client issue; try
changing app.config at the client instead. For example, for basic-http
you might have:

<bindings>
<basicHttpBinding>
<binding ... maxReceivedMessageSize="6553600" maxBufferSize="6553600">
<readerQuotas maxArrayLength="250000" />
</binding>
</basicHttpBinding>
</bindings>

Additionally, you might want to think about using streamed MTOM if you
are returning binary; you can add transferMode="Streamed" and
messageEncoding="Mtom" to "binding" for basic-http (but not for all
bindings) - but you need to do this at both the client and the server or
it will break [which is why I didn't add them above].
The quotas etc should be fine set at one end only (since it is expected
that client and server should have different quotas).

Marc
 
M

Marco Pais

Thanks for the reply.

So, you say that I can configure client independently, without the need to
configure the server? The problem is when downloading data, never with
upload. And how can I do this? Because I used this client config:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<system.serviceModel>

<bindings>

<basicHttpBinding>

<binding name="ServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"

receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"

bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"

messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

useDefaultWebProxy="true">

<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"

maxBytesPerRead="4096" maxNameTableCharCount="16384" />

<security mode="None">

<transport clientCredentialType="None" proxyCredentialType="None"

realm="" />

<message clientCredentialType="UserName" algorithmSuite="Default" />

</security>

</binding>

</basicHttpBinding>

</bindings>

<client>

<endpoint address="http://servidor:8080/ws/Service.asmx"
binding="basicHttpBinding"

bindingConfiguration="BasicHttpBinding_IOrderService"
contract="IOrderService"

behaviorConfiguration="LargeQuotaBehavior"

name="ServiceSoap" />

</client>

</system.serviceModel>

</configuration>


and I get this error:

"There is no endpoint behavior named 'LargeQuotaBehavior'. "

Thanks in advance.
 
M

Marc Gravell

behaviorConfiguration relates to the "behaviors" element, and can be
used to create your own stack with custom listeners etc. I think you can
remove this attribute; bindingConfiguration relates to the binding -
you've named this "ServiceSoap", so this is what the
bindingConfiguration attribute should say.

"BasicHttpBinding_IOrderService" looks like it should be the name (which
can often actually be left blank).

So try:

<client>
<endpoint address="http://servidor:8080/ws/Service.asmx"
binding="basicHttpBinding"
bindingConfiguration="ServiceSoap"
contract="IOrderService"
name="BasicHttpBinding_IOrderService" />
</client>

If you get errors about not finding the configuration, try removing the
name attribute. Also - I'm a little worried about it finding the
contract - I usually use the full-qualified name
(Foo.Bar.IOrderService), but if it works...

Marc
 
M

Marc Gravell

So, you say that I can configure client independently,
without the need to configure the server?

This is pretty-much limited to quotas, maximum sizes, and behaviors
(i.e. a behavour can be used to inject error-handling or performance
metrics - these aren't part of the channel itself). Pretty-much
everything else must match. It will tell you soon enough if there is a
problem...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top