The maximum receive message size at the remote server needs to
be changed.
This is only an option is you are responsible for the web-service on
the remote web-server.
On the remote server edit the web.config file. To set the maximum
receive message size first (i.) create a new binding which takes the
new receive message size and then (ii.) associated that binding with
the web-service.
Step 1. Create a new binding with the new receive message size
In the web.config file add a new binding, and set the
maxReceivedMessageSize for that binding to the desired value.
So if you wanted to be able to receive messages up to say
1MB (1,048,576 bytes) then you could add a binding similar to the
following:
<configuation>
.
.
<system.serviceModel>
.
.
<bindings>
<basicHttpBinding>
<binding name="Binding1" maxReceivedMessageSize="1048576"/>
</basicHttpBinding>
</bindings>
.
.
</system.serviceModel>
</configuration>
The name "Binding1" in the above is not
significant, but it
must be unique. So if you have multiple different bindings then each
must have a unique name. A descriptive name might be better than the
name I have used above. The maxReceivedMessageSize value is specified in
bytes.
Step 2. Associate that binding with the web-service
In the web.config file add a service record, such as:
<configuation>
.
.
<system.serviceModel>
.
.
<services>
<service name="MyService">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="Binding1"
contract="IMyService"/>
</service>
</services>
.
.
</system.serviceModel>
</configuration>
The service name must be the fully qualified name of the service.
If you are not sure what this is then look in the corresponding
.svc file and it
should be the same as the name given there.
The bindingConfiguration should be set to the same name used when
creating the binding with the larger maxReceiveBufferSize.
The contract should be the fully qualified name of the service
contract class or interface.
Be aware that allowing larger requests does make the server more
prone to possible denial of service requests. So consider carefully
how large a request you will allow, and consider whether there might
be a safer alternative.