久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Bitmap.Save 上的 ASP.NET 錯誤“異常 (0x80004005):GDI+ 中

ASP.NET error on Bitmap.Save quot;Exception (0x80004005): A generic error occurred in GDI+.quot;(Bitmap.Save 上的 ASP.NET 錯誤“異常 (0x80004005):GDI+ 中發生一般錯誤.)
本文介紹了Bitmap.Save 上的 ASP.NET 錯誤“異常 (0x80004005):GDI+ 中發生一般錯誤".的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個函數,它首先從磁盤讀取圖像,調整其大小,然后保存到另一個目錄.

I have a function which first reads an image from disk, resizes it and then saves to another directory.

當我使用 Bitmap.Save(directory + theimagename) 時,它會返回我在問題標題中所述的錯誤.

when i use the Bitmap.Save(directory + theimagename) it returns the error as i stated in the question title.

我檢查了目錄是否正確,該目錄中不存在給定的圖像名稱.

i checked the directory is right, and the given image name doesn't exist in that dir.

奇怪的是,相同的代碼在本地機器上運行良好.但是當我將它上傳到我的共享托管空間時,它就不起作用了.

what is weird, is that the same code works great on the local machine. but when i upload it to my shared hosting space, it just doesn't work.

代碼如下.

bmpOut = new Bitmap(Size, Size);
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(Brushes.White, 0, 0, Size, Size);
int topBottomPadding = 0; int leftRightPadding = 0;
if (Size > lnNewWidth + 1)
    leftRightPadding = Convert.ToInt32((Size - lnNewWidth) / 2);
else if (Size > lnNewHeight + 1)
    topBottomPadding = Convert.ToInt32((Size - lnNewHeight) / 2);
g.DrawImage(loBMP, leftRightPadding, topBottomPadding, lnNewWidth, lnNewHeight);
Bitmap bmp = new Bitmap(bmpOut);
if (bmp != null)
    bmp.Save(ResizedOutput); // C:InetpubvhostsDomainNamehttpdocsProductImages500pxgigabyte_ga_ep45_ds4_profilelarge[1].jpg
bmp.Dispose();
bmpOut.Dispose();
g.Dispose();
loBMP.Dispose();

堆棧跟蹤:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
   System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +377630
   System.Drawing.Image.Save(String filename, ImageFormat format) +69
   System.Drawing.Image.Save(String filename) +25
   Utilities.ResizeImage(String fileName, String mode) in c:inetpubvhostsatuhanakcay.comhttpdocsApp_CodeUtilities.cs:181
   Link.ToProductImage(String fileName) in c:inetpubvhostsatuhanakcay.comhttpdocsApp_CodeLink.cs:79
   Product.PopulateControls(ProductDetails pd) in c:inetpubvhostsatuhanakcay.comhttpdocsProduct.aspx.cs:37
   Product.Page_Load(Object sender, EventArgs e) in c:inetpubvhostsatuhanakcay.comhttpdocsProduct.aspx.cs:20

推薦答案

來自 ASP Net - GDI+ 并在服務器上保存 JPG 或 BMP

99.9% 的情況下,在使用 GDI 時,發生一般錯誤"意味著您要保存到的目錄沒有適當的權限.通常,您需要確保目錄允許 ASP.NET修改文件.

99.9% of the time, when using GDI, 'a generic error occured' means that the directory you are trying to save to doesn't have the proper permissions. Typically, you need to make sure that the directory is allowing ASP.NET to modify files.

你檢查權限了嗎?

這篇關于Bitmap.Save 上的 ASP.NET 錯誤“異常 (0x80004005):GDI+ 中發生一般錯誤".的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Right-click on a Listbox in a Silverlight 4 app(右鍵單擊 Silverlight 4 應用程序中的列表框)
WPF c# webbrowser scrolls over top menu(WPF c# webbrowser 在頂部菜單上滾動)
C# Console app - How do I make an interactive menu?(C# 控制臺應用程序 - 如何制作交互式菜單?)
How to avoid duplicate form creation in .NET Windows Forms?(如何避免在 .NET Windows Forms 中創建重復的表單?)
Building a database driven menu with ASP.NET, JQuery and Suckerfish(使用 ASP.NET、JQuery 和 Suckerfish 構建數據庫驅動的菜單)
UI Automation Control Desktop Application and Click on Menu Strip(UI自動化控制桌面應用程序并單擊菜單條)
主站蜘蛛池模板: 成人免费视频网站在线看 | 龙珠z在线观看 | av一区在线观看 | 免费一区二区三区 | 日韩国产在线 | 国产视频精品在线观看 | 欧美一区二区三区在线看 | 欧美一级在线 | 亚洲精品久久久一区二区三区 | 久久久久久久国产 | 国产精品一区二区av | 午夜国产羞羞视频免费网站 | 日韩成人免费 | 精品国产一区二区三区免费 | 丁香色婷婷 | 91av大全| 久久精品小视频 | 国产精品一级 | 国产香蕉视频在线播放 | 成人中文字幕在线观看 | 男女爱爱福利视频 | 密桃av | 在线第一页 | 成人国产精品 | 欧美精品国产一区二区 | 国产精品久久亚洲 | 亚洲一区二区三区四区五区午夜 | 国产一级淫片a直接免费看 免费a网站 | 久久久国产一区二区三区四区小说 | 这里只有精品99re | 日韩一区二区三区在线 | 成人免费精品视频 | 久久精品久久综合 | 一级免费视频 | 91精品国产综合久久久密闭 | 成人性视频在线 | 色综合天天综合网国产成人网 | 97成人在线 | 在线看片国产精品 | 欧美成人精品一区二区三区 | 国产一区二区在线播放 |