Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   .NET (https://www.clubdelphi.com/foros/forumdisplay.php?f=17)
-   -   Problema mostrando imagenes en C# aspx .NET (https://www.clubdelphi.com/foros/showthread.php?t=43479)

JuanErasmo 12-05-2007 02:12:11

Problema mostrando imagenes en C# aspx .NET
 
Buenas noches amigos.
Tengo un problema amigos con una aplicacion que hice en C#
la aplicacion muestra imagenes, y funcionaba perfectamente, pero tuve que formatear mi pc, y sigue funcionando bien, pero a la hora de cargar imagenes me sale el siguiente error
Código:


Server Error in '/mi aplicacion' Application.

The process cannot access the file 'C:\fotos\peronales\413079\413079\imagen_01.jpg' because it is being used by another process.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'C:\fotos\personales\413079\413079\imagen_01.jpg' because it is being used by another process.

Source Error:

Line 159:    protected void ButtonVer_Click(object sender, EventArgs e)Line 160:    {Line 161:        FileStream f = new FileStream((ListBox3.SelectedValue.ToString()), FileMode.Open);Line 162:Line 163:        byte[] b = new byte[f.Length];
Source File: c:\Inetpub\wwwroot\biomedicalm\Medicos.aspx.cs    Line: 161

Stack Trace:

[IOException: The process cannot access the file 'C:\fotos\personales\413079\413079\imagen_01.jpg' because it is being used by another process.]  System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2014461  System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +998  System.IO.FileStream..ctor(String path, FileMode mode) +65  Medicos.ButtonVer_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\miaplicacion\formulario1.aspx.cs:161  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107  System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


ademas, no me esta mostrando las imagenes en vista en miniatura, yo ya habia desarrollado esto, y no me las deja cargar.....
como tengo que configurara el IIS para que funcione correctamente como antes? que permisos debo habilitar?

Estoy seguro de que las imagenes no estan siendo utilizadas por otro proceso. se dejan abrir 1 vez, y luego al intentar reabrirlas en mi aplicacion, me sale ese error, es como si la estuviera utilizando la misma aplicacion,
hay un time out o algo asi???

Muchas gracias amigos

__hector 16-05-2007 17:00:36

Algunas cosas:

- Aunque redundante, asegurate de estar cerrando el stream cada vez que terminas de ejecutar el metodo para mostrarlas. Preferiblemente, usando bloques de try/finally, o la clausula using.

- A veces cuando tienes la ventana del explorador de windows abierta en la misma carpeta donde estan las imagenes, y los iconos se muestran en vista previa, al parecer el proceso de explorer.exe bloquea el archivo para leer y mostrar la imagen que contiene. Eso me ha pasado antes con imagenes y videos que no podia borrar.

- Fijate que el proceso de aspnet tiene permisos de escritura y lectura en ese directorio. Prueba guardando un archivo, o leyendo cualquier otro.

- Finalmente, puedes conseguir uno de esos programitas para windows que te permiten ver que procesos estan utilizando un archivo especifico. Esto puede darte mas luz sobre el origen de tu problema.


La franja horaria es GMT +2. Ahora son las 05:21:56.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi