none
Get an array of bytes through a web api RRS feed

  • Question

  • Hi, I have the following API:

    public class ExpedientesController : ApiController
        {
            private Ejercicio2Entities db = new Ejercicio2Entities();
     
            // GET: api/Expedientes
            public HttpResponseMessage GetExpediente()
            {
                db.Configuration.ProxyCreationEnabled = false;
                db.Configuration.LazyLoadingEnabled = true;
                var expediente = db.Expediente.Select(e => new ExpedientePOCO
                {
                    idExpediente = e.idExpediente,
                    NombreExpediente = e.NombreExpediente,
                    CantidadDocumento = e.CantidadDocumento,
                    DuenioExpediente = e.DuenioExpediente,
                    FechaCreacion = e.FechaCreacion,
                    Documentos = e.Documento.Select(x => new DocumentoPOCO
                    {
                        NombreDocumento = x.NombreDocumento,
                        idExpediente = x.idExpediente,
                        FechaCreacion = x.FechaCreacion,
                        idDocumento = x.idDocumento,
                        Archivos = x.Archivo.Select(a=>new ArchivoPOCO
                            { idDocumento = a.idDocumento,
                                idArchivo = a.idDocumento,
                                NombreImagen = a.NombreImagen,
                                ArchivoImg = a.ArchivoImg})
                    })
                });
                if (expediente.Any())
                {
                    return Request.CreateResponse(HttpStatusCode.OK, expediente);
                }
                else
                {
                    return Request.CreateErrorResponse(HttpStatusCode.NotFound,
                        "No se encontraron expedientes.");
                }
            }

    where ArchivoIMG is an array of byte, but whenever  I try to retrieve the data, I get an out of memory exception, I'm retrieving the information in json format. Any idea how can I fix it?

    Thanks!

    Regards.

    • Moved by Bob Ding Thursday, January 18, 2018 1:51 AM asp.net related
    Wednesday, January 17, 2018 9:45 PM

All replies

  • Hi nando_O,

    This forum discusses and asks questions about Windows Presentation Foundation (WPF) , since your issue is more related to asp.net web API, I would suggest that you could post your issue Web API forum for suitable support.

    https://forums.asp.net/1246.aspx/1?Web+API

    Thanks for your understanding and cooperation.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 18, 2018 1:48 AM