This is a migrated thread and some comments may be shown as answers.

RadBarCode GetImage throws GDI+ error on server

6 Answers 246 Views
Barcode
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 13 Aug 2014, 12:13 PM
When we use the RadBarcode.GetImage() running the asp.net 4.0 site inside the visual studio 2012 IDE all is well and we can save and display the png on our site.  When  running the site on the server we get the following error:

A generic error occurred in GDI+.    at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
   at System.Drawing.Image.Save(String filename, ImageFormat format)

No other error information is provided.   Are there perhaps some other support assemblies needed that may be needed on the server?    This telerik upgrade is being tested on 2003 server, where all other telerik stuff works just fine for a number of sites.  Is it possible the older server just doesn't support some GDI+ functionality that you require, and our only option is to move to server 2008?

We are in the process of switching our sites from rather ancient Windows Server 2003 to Windows Server 2008 so that's not a show-stopper.  We just weren't quite ready to deploy this testing site there.

6 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 18 Aug 2014, 08:46 AM
Hi John,

I believe that the following forum thread could be helpful for you to resolve this generic ASP.NET error:

http://stackoverflow.com/questions/1044085/a-generic-error-occurred-in-gdi.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
John
Top achievements
Rank 1
answered on 19 Aug 2014, 11:55 AM
I've read that document and don't believe it is related to the RadBarcode.GetImage problem (at least not in a way I can do anything about).  All the relevant activity takes place INSIDE the RadBarcode.GetImage() method, which is where the exception is thrown.  As far as I know, I have no way of affecting how RadBarcode decides to do its bitmap work and which graphics techniques it uses. All I can do is setup the barcode text/type properties and call GetImage().  As mentioned, I am guessing that the problem is related more to RadBarcode assuming some minimum amount of GDI+ support that is perhaps not present on our Windows 2003 webserver.  Can you verify this?
0
John
Top achievements
Rank 1
answered on 21 Aug 2014, 12:32 PM
We get the same GDI+ error on windows server 2008 r2.  We running the site as .Net 4.0 and use the 4.0 versions of the telerik assemblies. This is becoming very serious for us. Can anyone provide any information on a solution?  Again, this is an error internal to the RadBarcode.GetImage() method.  It works fine on any of our development machines.  As mentioned before, the only information we get in the exception is the following, with no inner exception.  

A generic error occurred in GDI+.    at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)

0
John
Top achievements
Rank 1
answered on 21 Aug 2014, 02:00 PM
Many reports on this GDI+ error (not just Telerik) stress a bad path.  Although we don't give any paths to the RadBarcode.GetImage(), perhaps it is internally assuming access to some undocumented path for temp working files?  If so, I can grant the proper access.  Just don't know what path it would be missing rights to.
0
John
Top achievements
Rank 1
answered on 21 Aug 2014, 03:39 PM
(puts on hat of shame)
Was not Teleriks problem.  I misinterpreted error and have resolved things with the usual privilege assignement related to GDI+ errors.  Apologies for the blame-telerik-first.
0
Paolo
Top achievements
Rank 2
answered on 07 Jul 2020, 02:19 AM

Hi Support and John

Sorry to resurrect an old thread - We are having an identical problem in a production environment (generating and rendering a QR code), with the only difference being that the operation seems to work fine for some time, until we hit the above error.

Restarting the app pool temporarily resolves the problem, until it happens again after a while... possibly a build up, a concurrency issue, a clash with the temp filename where the QR code is saved?... could be anything, but we have no idea where to look for the next clue given that the behaviour is so inconsistent / sporadic, and we don't have access to the inner workings of the RadBarcode logic.

Would you be able to offer any pointers?

Thanks in advance, Paolo

Tags
Barcode
Asked by
John
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
John
Top achievements
Rank 1
Paolo
Top achievements
Rank 2
Share this question
or