Send file by webservice

Posted by phenevo on Stack Overflow See other posts from Stack Overflow or by phenevo
Published on 2010-05-21T13:29:27Z Indexed on 2010/05/21 13:30 UTC
Read the original article Hit count: 311

Hi,

I have webservice, wwith method:

[WebMethod]
public byte[] GetFile(string FName)
{
    System.IO.FileStream fs1 = null;
                fs1 = System.IO.File.Open(FName, FileMode.Open, FileAccess.Read);
    byte[] b1 = new byte[fs1.Length];
    fs1.Read(b1, 0, (int)fs1.Length);
    fs1.Close();
    return b1; 
}

and it works with small file like 1mb, but when it comes to photoshop's file (about 1,5gb) I get:

System.OutOfMemoryException

The idea is I have winforms application which get this file and saving it on local disc.

© Stack Overflow or respective owner

Related posts about c#

Related posts about webservice