本文介绍了(0x80004005):GDI +中发生一般错误。在vb.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 以下在本地计算机上工作正常,但在实时服务器上不起作用 受保护的 可覆盖 Sub qrCodeImage_Changed( ByVal sender As System。 Object )句柄 我 .OnQRCodeImageChanged ' Dim strImageOriginal As String = strGuid.ToString()+ strImageSize Dim id 作为 字符串 = Guid.NewGuid.ToString Dim strImageOriginal 作为 字符串 S选举 案例 Request.Cookies( Tab_Name )。Value.ToString Case vcard strImageOriginal = Vcard _& txt_firstname.Text& _& txt_lastname.Text 案例 event strImageOriginal = EVent _& Regex.Replace(txtEvent.Text, [\ [\] \\\ ^ \ $ \.\ | \ * \ + \(\)\ {\}%;!>< @#&安培; \-\ + \ / \ :], )。替换( http, )。替换( www, )。分割( )( 0 ) 案例 qrFlikr strImageOriginal = Directory.GetFiles(Server.MapPath( QRflikr), *。*)。Length.ToString& _& Guid.NewGuid.ToString 案例 其他 strImageOriginal = Regex.Replace(s , [\ [\] \\\ ^ \ $ \。\ | \\ \\ \\ \ * \ + \(\)\ {\}%,;>< @#&安培; \-\ + \ / \?!] , )。替换( http, )。 ( www, )。分割( )( 0 ) 结束 选择 ImageQrCode.Sa ve(Server.MapPath( QRImages / + strImageOriginal + id + 。png),System.Drawing.Imaging.ImageFormat.Png) ImageQrCode.Dispose() 如果 不 Request.Cookies( overlay)。Value = 和 不 Request.Cookies( overlay)。值= '' 然后 ImageButton1.ImageUrl = Dim picBackground As Image = Image.FromFile(Server.MapPath(Request.Cookies( overlay)。值)) Dim picForeground As Image = Image.FromFile(Server.MapPath( QRImages / + strImageOriginal + id + 。png)) Dim finalimage As Image = OverlayImages(picForeground,picBackground) picBackground.Dispose() picForeground.Dispose() finalimage.Save(Server .MapPath( QRImages / + strImageOriginal + id + 。png)) ImageButton1.ImageUrl = QRImages / + strImageOriginal + id + 。png 其他 ImageButton1.ImageUrl = QRImages / + strImageOriginal + id + 。png 结束 如果 结束 Sub 解决方案 \.\ | \ * \ + \(\)\ {\}%;!>< @#&安培; \-\\ \\ + \ / \:], )。替换( http, )。替换( www, )。分割( )( 0 ) 案例 qrFlikr strImageOriginal = Directory.GetFiles(Server.MapPath( QRflikr), *。*)。Length.ToString& _& Guid.NewGuid.ToString 案例 其他 strImageOriginal = Regex.Replace(s , [\ [\] \\\ ^ \ \.\ | \ * \ + \(\)\ {\}%;!>< @#&安培; \-\ + \ / \:], )。替换( http, )。替换( www, )。Split( )( 0 ) 结束 选择 ImageQrCode.Save(Server.MapPath( QRImages / + strImageOriginal + id + 。png),System.Drawing.Imaging.ImageFormat.Png) ImageQrCode。 Dispose() 如果 不 Request.Cookies( overlay)。Value = 不 Request.Cookies( overlay)。值= '' 然后 ImageButton1.ImageUrl = Dim picBackground As Image = Image.FromFile(Server.MapPath(Request.Cookies( overlay)。值)) Dim picForeground 作为 Image = Image.FromFile(Server.MapPath( QRImages / + strImageOriginal + id + 。png)) Dim finalimage As Image = OverlayImages(picForeground,picBackground) picBackground.Dispose() picForeground.Dispose() finalimage.Save(Server.MapPath( QRImages / + strImageOriginal + id + 。png)) ImageButton1.ImageUrl = QRImages / + strImageOriginal + id + 。png 其他 ImageButton1.ImageUrl = QRImages / + strImageOriginal + id + 。png 结束 如果 结束 Sub 1。告诉我们发生错误的行(为此你必须创建日志文件) 2.同时检查在服务器上创建的文件夹应该有权创建/保存文件 the following works fine on local machine but did not work on live serverProtected Overridable Sub qrCodeImage_Changed(ByVal sender As System.Object) Handles Me.OnQRCodeImageChanged 'Dim strImageOriginal As String = strGuid.ToString() + strImageSize Dim id As String = Guid.NewGuid.ToString Dim strImageOriginal As String Select Case Request.Cookies("Tab_Name").Value.ToString Case "vcard" strImageOriginal = "Vcard_" & txt_firstname.Text & "_" & txt_lastname.Text Case "event" strImageOriginal = "EVent_" & Regex.Replace(txtEvent.Text, "[\[\]\\\^\$\.\|\?\*\+\(\)\{\}%,;><!@#&\-\+\/\:]", "").Replace("http", "").Replace("www", "").Split(" ")(0) Case "qrFlikr" strImageOriginal = Directory.GetFiles(Server.MapPath("QRflikr"), "*.*").Length.ToString & "_" & Guid.NewGuid.ToString Case Else strImageOriginal = Regex.Replace(s, "[\[\]\\\^\$\.\|\?\*\+\(\)\{\}%,;><!@#&\-\+\/\:]", "").Replace("http", "").Replace("www", "").Split(" ")(0) End Select ImageQrCode.Save(Server.MapPath("QRImages/" + strImageOriginal + id + ".png"), System.Drawing.Imaging.ImageFormat.Png) ImageQrCode.Dispose() If Not Request.Cookies("overlay").Value = "" And Not Request.Cookies("overlay").Value = "''" Then ImageButton1.ImageUrl = "" Dim picBackground As Image = Image.FromFile(Server.MapPath(Request.Cookies("overlay").Value)) Dim picForeground As Image = Image.FromFile(Server.MapPath("QRImages/" + strImageOriginal + id + ".png")) Dim finalimage As Image = OverlayImages(picForeground, picBackground) picBackground.Dispose() picForeground.Dispose() finalimage.Save(Server.MapPath("QRImages/" + strImageOriginal + id + ".png")) ImageButton1.ImageUrl = "QRImages/" + strImageOriginal + id + ".png" Else ImageButton1.ImageUrl = "QRImages/" + strImageOriginal + id + ".png" End If End Sub 解决方案 \.\|\?\*\+\(\)\{\}%,;><!@#&\-\+\/\:]", "").Replace("http", "").Replace("www", "").Split(" ")(0) Case "qrFlikr" strImageOriginal = Directory.GetFiles(Server.MapPath("QRflikr"), "*.*").Length.ToString & "_" & Guid.NewGuid.ToString Case Else strImageOriginal = Regex.Replace(s, "[\[\]\\\^\\.\|\?\*\+\(\)\{\}%,;><!@#&\-\+\/\:]", "").Replace("http", "").Replace("www", "").Split(" ")(0) End Select ImageQrCode.Save(Server.MapPath("QRImages/" + strImageOriginal + id + ".png"), System.Drawing.Imaging.ImageFormat.Png) ImageQrCode.Dispose() If Not Request.Cookies("overlay").Value = "" And Not Request.Cookies("overlay").Value = "''" Then ImageButton1.ImageUrl = "" Dim picBackground As Image = Image.FromFile(Server.MapPath(Request.Cookies("overlay").Value)) Dim picForeground As Image = Image.FromFile(Server.MapPath("QRImages/" + strImageOriginal + id + ".png")) Dim finalimage As Image = OverlayImages(picForeground, picBackground) picBackground.Dispose() picForeground.Dispose() finalimage.Save(Server.MapPath("QRImages/" + strImageOriginal + id + ".png")) ImageButton1.ImageUrl = "QRImages/" + strImageOriginal + id + ".png" Else ImageButton1.ImageUrl = "QRImages/" + strImageOriginal + id + ".png" End If End Sub1. Tell us line where error occurs (for this u have to create log file)2. Also check folder created on server should have rights to create/save files 这篇关于(0x80004005):GDI +中发生一般错误。在vb.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 14:34