Je webservice, avec la méthode:Envoi gros fichier par webservice et OOM exception
[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;
}
et il fonctionne avec un petit fichier comme 1Mo, mais quand il s'agit de fichier de photoshop (environ 1,5gb) Je reçois:
System.OutOfMemoryException
sur cette ligne:
Byte[] img = new Byte[fs.Length];
L'idée est que j'ai application winForms qui obtenir ce fichier et l'enregistrer o n disque local.