hello,
I have strange problem:
- i try to open or save jpeg file and I get the error
- the same jpeg and the same code works ok on developer machine, jpeg opens using the same code
- problem occures only on production machine
- jpeg opens when I try open it clicking twice on it on production machine
My code looks that:
Using imageStream As New MemoryStream(currentMhtxAttachment.AttachmentBytes)
Dim exceptionOccurs as Boolean = False
Try
Using img As New Bitmap(imageStream)
context.Response.ContentType = currentMhtxAttachment.ContentType
img.Save(context.Response.OutputStream, Imaging.ImageFormat.Jpeg)
context.Response.Flush()
End Using
Catch ex As Exception
exceptionOccurs = true
Log.Write(ex.ToString(), enmLogTypes.LOG_ERROR)
End Try
If exceptionOccurs Then
dim filePath = String.Empty
Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(imageStream)
Dim pathdir As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "DocView")
If Not Directory.Exists(pathdir) Then
Directory.CreateDirectory(pathdir)
End If
Dim filename = Guid.NewGuid().ToString()
filePath = System.IO.Path.Combine(pathdir, filename)
using options as New JpegOptions()
image.Save(filePath, options)
End Using
End Using
Using image as New Bitmap(filePath, false)
context.Response.ContentType = currentMhtxAttachment.ContentType
image.Save(context.Response.OutputStream, Imaging.ImageFormat.Jpeg)
context.Response.End()
End Using
End If
End Using
in this line:
img.Save(context.Response.OutputStream, Imaging.ImageFormat.Jpeg)
occurs error:
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at ImageHandler.ProcessRequest(HttpContext context)
and
in this line:
Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(imageStream)
occurs this:
Aspose.Imaging.CoreExceptions.ImageLoadException: Image loading failed. —> Aspose.Imaging.CoreExceptions.ImageLoadException: Cannot open an image. The image file format may be not supported at the moment.
at Aspose.Imaging.Image.�(StreamContainer �, LoadOptions �)
— End of inner exception stack trace —
at Aspose.Imaging.Image.�(StreamContainer �, LoadOptions �)
at Aspose.Imaging.Image.Load(Stream stream, LoadOptions loadOptions)
at ImageHandler.ProcessRequest(HttpContext context)
Could you help me what is wrong on the production machine?
received_918975251775069_1.jpeg (674.8 KB)