Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Tengo un API de servicios haciendo uso de ASP.NET MVC 4 y Web API y necesito manejar el envío de imágenes almacenadas en una base de datos.

Mi intención era manejar listas, es decir meter todas las imágenes, que me pueda regresar una consulta, en una lista de tipo string, para esto convierto el arreglo de bytes que obtengo de la consulta de la imagen y la transformo a string usando Convert.ToBase64String.

Entonces, haciendo una sola petición, el Web Service me regresa la lista para que el cliente maneje las imágenes y las muestre en una aplicación. El detalle aquí es que me dí cuenta de que hay un límite máximo de memoria que puede usar una petición (no estoy seguro de cuando sólo que no me permite muchas imágenes) y no siempre puedo enviar todas las imágenes en una lista.

Así que se me ocurrió enviar imagen por imagen haciendo una petición por cada una, pero ¿qué pasaría si son 20 imágenes a enviar?, se harían 20 peticiones; y si son 10 usuarios que necesiten descargar información con 20 imágenes cada uno, serían 200 peticiones.

Mis dudas son, ¿qué pasará con el servidor, colapsará o qué?, ¿que tan correcta es la manera que estoy usando para el envío de imágenes, por listas (aunque no creo que me sirva de mucho) o por imagen?, ¿qué tendría que hacer en caso de que teniendo 10 de los 20 archivos descargados se perdiera la conexión a la red?, ¿existe una forma de hacer esto pero sin tantas peticiones? y si alguien me podrá explicar como funciona el webservice en cuanto a recursos usados o sería problema del IIS (que por cierto estoy usándolo para publicar el web service).



GOOGLE TRANSLATE VERSION

I have a service API using ASP.NET MVC 4 and Web API and I need to handle shipping stored in a database images.

My intention was to manage lists, ie put all the images, you can return me a query, a list of type string, for this I make the array of bytes to get from the query image and transform a string using Convert. ToBase64String.

So making a single request, the Web Service returns me the list to the client and manage images displayed in an application. The detail here is that I realized that there is a maximum limit of memory you can use an application (I'm not sure when I just do not allow many images) and can not always send all images in a list.

So I came up image by image by sending a request by each, but what if there are 20 pictures to send ?, 20 requests would be made; and if they are 10 users who need to download information 20 images each, would be 200 requests.

My question is, what will happen to the server, collapse or what ?, how correct is the way I'm using for sending images, lists (although I do not think it serves me well) or image ?, Why would I do if taking 10 of the 20 files downloaded to the network connection is lost ?, Is there a way to do this without so many requests? and if someone can explain to me how the webservice as to be used or IIS problem (which incidentally I'm using it to publish the web service) resources.
Posted
Updated 21-Sep-15 10:39am
v2
Comments
PIEBALDconsult 21-Sep-15 16:22pm    
Can you get that translated to English?
Maciej Los 21-Sep-15 16:34pm    
This is English forum. Please, use English.

1 solution

Question was reposted in English and answered here - Best way to handle sending images using a REST API services (ASP.NET MVC 4 C #)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900