【发布时间】:2011-01-11 19:22:08
【问题描述】:
我遇到了一个 GDI+ 通用错误我已经尝试了大家所说的,即确保包含正在读取的图像文件的文件夹像这样
public ImageResult ProfileAsset(string profile, int width, int height) {
PhotoDB imgstr = new PhotoDB();
Image FullsizeImage = Image.FromFile(
imgstr.getFilePath(profile, false, PhotoDB.PhotoSize.None)
);
Image cropedImage = imgstr.Crop(FullsizeImage, width, width, PhotoDB.AnchorPosition.Center);
return new ImageResult { Image = cropedImage, ImageFormat = ImageFormat.Png };
}
我已将该文件夹的权限设置为所有人,但仍然出现此错误?
有什么想法吗?
GDI+ 中出现一般错误。 描述:未处理的异常 在执行过程中发生 当前的网络请求。请查看 堆栈跟踪以获取有关的更多信息 错误及其起源 代码。
异常详情: System.Runtime.InteropServices.ExternalException: GDI+ 中出现一般错误。
来源错误:
产生了一个未处理的异常 在当前执行期间 网络请求。有关的信息 异常的起源和位置 可以使用异常识别 下面的堆栈跟踪。
堆栈跟踪:
[外部异常(0x80004005):A GDI+ 中出现一般错误。]
System.Drawing.Image.Save(流 流,ImageCodecInfo 编码器, 编码器参数编码器参数) +378002 System.Drawing.Image.Save(流 流,ImageFormat 格式)+36
哈瓦那.ImageResult.ExecuteResult(ControllerContext 上下文)在 C:\DropBox\My Dropbox\Havana\Havana.MVC\Infrastructure\ImageResult.cs:44 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext 控制器上下文,动作结果 行动结果)+10
System.Web.Mvc.c__DisplayClass11.b__e() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter 过滤器,ResultExecutingContext preContext,Func1 continuation) +251 System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 过滤器, ActionResult actionResult) +178
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext 控制器上下文,字符串动作名称) +399 System.Web.Mvc.Controller.ExecuteCore() +126 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean & completedSynchronously) +75
【问题讨论】:
标签: asp.net-mvc gdi+