5

Is it possible to customize the parameters of a WCF RIA Services endpoint? Specifically, I would like to create a custom binding for the endpoint and increase the maxReceivedMessageSize to allow sending the contents of a file that is a few megabytes in size.

I've tried meddling in the web.config, but I'm getting the following error:

[InvalidOperationException]: The contract name MyNamespace.MyService could not be found in the list of contracts implemented by the service MyNamespace.MyService

web.config

<system.serviceModel>
  <bindings>
    <customBinding>
      <binding name="CustomBinaryHttpBinding">
        <binaryMessageEncoding />
        <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
      </binding>
    </customBinding>
  </bindings>
  <services>
    <service name="MyNamespace.MyService">
      <endpoint address="" binding="wsHttpBinding" contract="MyNamespace.MyService" />
      <endpoint address="/binary" binding="customBinding" bindingConfiguration="CustomBinaryHttpBinding" contract="MyNamespace.MyService" />
    </service>
  </services>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Andrew Garrison
  • 6,977
  • 11
  • 50
  • 77

1 Answers1

0

We had a similar problem - we want to send large bitmaps fom Silverlight client to Server using WCF-RIA service invoke operation.

The following change in Web.config worked for us:

<httpRuntime requestValidationMode="2.0" maxRequestLength="6225920"/>

See How to configure Parameter/Message length for WCF-RIA-Service operation

Community
  • 1
  • 1
GarethOwen
  • 6,075
  • 5
  • 39
  • 56