-1

I'm currently working on a solution to upload and download files to a WCF service. The client is a class inheriting from ClientBase. I've read the MSDN article on streaming and links on StackOverflow and elsewhere, but I can't seem to figure out why I'm still getting a message about the Message size being too small. I have tested the solution so far with small files and it works.

The service is hosted in IIS 7.5

Here's the App.config from the Client application

<system.web>
    <httpRuntime maxRequestLength="67108864" />
</system.web>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding messageEncoding="Mtom" transferMode="Streamed" name="LargeFileStreamingHttpBinding"
                     maxBufferSize="65536"
                     maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
            </binding>

        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost/UpdateService.svc"
                        binding="basicHttpBinding"
                        contract="IUpdateService"
                        name="updateServiceEndpoint"/>

    </client>
</system.serviceModel>

Here are the relevant sections in the server

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

    <services>
        <service name="UpdateService" behaviorConfiguration="UpdateServiceBehavior">
                <endpoint binding="basicHttpBinding" bindingName="LargeFileStreamingWebHttpBinding" contract="IUpdateService"></endpoint>
                <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
        </service>
    </services>

    <behaviors>
        <serviceBehaviors>
                <behavior name="UpdateServiceBehavior" >
                        <serviceMetadata httpGetEnabled="true" />
                        <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
        </serviceBehaviors>
    </behaviors>

    <bindings>
        <basicHttpBinding>
                <binding messageEncoding="Mtom" transferMode="Streamed" name="LargeFileStreamingWebHttpBinding" 
                                 maxBufferSize="65536" 
                                 maxReceivedMessageSize="2147483647"
                                 />
        </basicHttpBinding>
    </bindings>
</system.serviceModel>

Additionally, I've added the following in on both server and client configs:

<system.web>
    <httpRuntime maxRequestLength="2147483647" />
</system.web>

This is how I'm instantiating the client

public class UpdateClient : ClientBase<IUpdateService>, IUpdateService
{
    public UpdateClient() : base("updateServiceEndpoint") {}
}

So does have any ideas where I could be going wrong? Any help is appreciated.

-Thanks!

abjbhat
  • 999
  • 3
  • 13
  • 24
  • Is the service class name just "UpdateService", or does it belong in some namespace? If the latter, you need to have the fully-qualified name on the `` for it to pick up the configuration. – carlosfigueira Sep 07 '11 at 17:10
  • I've omitted the service contract namespace for sake of brevity – abjbhat Sep 08 '11 at 04:48
  • Voted to close as too localized because nobody else who will make this particular mistake will ever find the answer by a search of this question. – John Saunders Sep 14 '11 at 02:54
  • Your question title describe what you service does but not what your problem is or the nature of your question. Suggest you make it more accurately reflect your question/problem. – Kirk Broadhurst Sep 14 '11 at 03:02
  • I agree actually. I had initially thought the problems with this implementation were technical but then found it was a simple mistake on my part. I should have closed/deleted this question myself. – abjbhat Sep 14 '11 at 04:30

1 Answers1

0

Found the answer - a very simple mistake, the client/endpoint entry was missing the bindingConfiguration attribute

abjbhat
  • 999
  • 3
  • 13
  • 24