在文件服务器中保存图像时抛出异常 [英] Throwing Exception when saving image in File Server

查看:143
本文介绍了在文件服务器中保存图像时抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我尝试将图像保存在服务器中时,抛出以下错误.

Hi,

When i am trying save the image in the server it''s throwing below error.

A generic error occurred in GDI+. 
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.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

Source Error: 


Line 166:                                    if (objFileUpload.impersonateValidUser())
Line 167:                                    {
Line 168:                                        ImgThnail.Save(Path.Combine(objFileServerImpersonation.FileServerPath(), ThumbnailPath), Img.RawFormat);
Line 169:ImgThnail.Dispose();



我正在使用模拟方法来验证用户凭据,以检查是否从服务器获取权限.



i am using impersonate method to validate user credentials to check get the permissions from the server.

推荐答案

此处检查这些修复链接

理解"GDI +中发生了一般性错误."错误 [ ^ ]
在GDI +,JPEG图像到MemoryStream的通用错误发生了 [ ^ ]
绘制图像时:System.Runtime.InteropServices.ExternalException :GDI中发生了一般性错误 [ ^ ]
System.Runtime.InteropServices.ExternalException:GDI +中发生了一般性错误. [
Here check these fix links

Understanding "A generic error occurred in GDI+." Error[^]
A generic error occurred in GDI+, JPEG Image to MemoryStream[^]
When drawing an image: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI[^]
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.[^]


尝试使用GC .搜集();在ImgThnail.Dispose();
Try using using GC.Collect(); after ImgThnail.Dispose();


这篇关于在文件服务器中保存图像时抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆