Kalpesh Rajai
Kalpesh Rajai

Reputation: 2056

Web services called using SoapClient

I develop one ASP.NET C# Web Services for upload the files. When I consume that web services and called the web method of it that have the arguments with byte[] with the size of 100 MB than it fire the error called OutOfMemoryException.

What I face:

  1. When I trying to send the byte[10485760] with the size of 10 MB than it successfully worked but when

  2. When I trying to send the byte[104857600] with the size of '100 MB' than it throw the errors called OutOfMemoryException.

I have the one web method in web services that given below.

[WebMethod]
    public bool MultiUpload(byte[] abtFile, string sFileName, string sFolderName)
    {
        bool bUploaded = true;

        return bUploaded;
    }

And I add the Web service in my ASP web app with the option of Add Web References

enter image description here

I create the object of that web services like this:

private FileUpload.FileUploadSoapClient objSoapClient=objSoapClient = new FileUploadSoapClient();

and I called the web method of web services like this:

byte[] abtBytes=new byte[104857600];//HAVE the bytes of images
sFileName="xyz.jpg";
sFolderName="Uploads/Images";
objSoapClient.MultiUpload(abtBytes, sFileName, sFolderName);

while calling the Web Method called 'MultiUpload' throws the exception called OutOfMemoryException. I don't what I missed.

Web.config file code:

<system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime executionTimeout="6000000" maxRequestLength="2147483647"/>
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483647"/>
      </requestFiltering>
    </security>
  </system.webServer>

Thanks in advanced.

Upvotes: 0

Views: 82

Answers (1)

Chetan Hirapara
Chetan Hirapara

Reputation: 694

Try to set maxBufferSize in configuration file.

increase receiveTimeout and set maxReceivedMessageSize="4294967295"

Upvotes: 1

Related Questions