plditallo
plditallo

Reputation: 701

wcf declarative wf service: web.config settings

Techies-- I have the ever-popular message: "The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding". Nothing new here--I need to do just what the message says. My trouble is I'm uncertain where to set this up in the services web.config file.

This is my first time working with declarative workflow services, so please hang in there with me. It looks like the web.config file that gets generated is a little lighter than the one generated for other types of wcf services. Here's the default straight out of the box:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
 </behaviors>
 <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
 </system.serviceModel>
 <system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

When I ran the svcutil.exe to generate the proxy class for this, here's what got generated:

 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_TelaPointSMService" 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://localhost:18781/TelaPointSMService.xamlx"
            binding="basicHttpBinding"
             bindingConfiguration="BasicHttpBinding_TelaPointSMService"
            contract="TelaPointSMService" name="BasicHttpBinding_TelaPointSMService" />
    </client>
   </system.serviceModel>
   </configuration>

So in the workflow service's web.config file, what/how am I going to declare to assure this service can handle a message larger than the default setting? I recognize the setting will have to change in the client bindings too--but where to make that change is clear.

Upvotes: 0

Views: 915

Answers (1)

Tim
Tim

Reputation: 28540

It looks like you're using 4.0, so the config file will be lighter due to default endpoints and bindings. The trouble with that, as you've seen, is that the default bindings have the default settings.

To resolve this, you can explicitly define a default binding in the service's config file that will be used for any services with that binding. To do this you define the binding as usual but you omit the name attribute, so you'd have something like this:

<system.serviceModel>     
  <bindings>         
    <basicHttpBinding>             
      <binding maxReceivedMessageSize="5242880" />
    </basicHttpBinding> 
  </bindings>
  <!-- The rest of your services config file -->
</system.serviceModel>

You may need to increase other values as well (buffer size, perhaps) so you add them in the same way you did maxReceivedMessageSize. The value 5242880 is one I've used in the past, but you may need a larger value (or a smaller value may work for you).

Upvotes: 1

Related Questions