0

I am developing WCF service with the following operation contract;

    [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "AddHCPRankAttachment", RequestFormat =
WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
        WSMessage AddHCPRankAttachment(HCPRankAttachmentEnt HCPAttachment, byte[] ImageInBytes);

When I call it like this:

ServiceReference1.Service1Client s = new ServiceReference1.Service1Client();
s.AddHCPRankAttachment(new HCPRankAttachmentEnt()
                {
                    AttachmentType = "a",
                    CreationDate = null,
                    HCPRankID = 1,
                    UserID = "EMP0000001",
                    Remarks = "rem"
                }, ary);

Where ary is my image converted to bytes ( Image size is 582 KB). I receive error

The remote server returned an error: (413) Request Entity Too Large in WCF Service.

I added the following to my web.config and restarted the website application in IIS, but still the same error.

<bindings>
            <basicHttpBinding>
            <binding maxReceivedMessageSize="2147483647"
            maxBufferSize="2147483647"
            maxBufferPoolSize="2147483647">
            <readerQuotas maxDepth="32"
            maxArrayLength="2147483647"
            maxStringContentLength="2147483647"/>
            </binding>
            </basicHttpBinding>
            </bindings>
Hassan Shouman
  • 275
  • 4
  • 13

0 Answers0