question

MarcosViniciusdosSantos-9491 avatar image
0 Votes"
MarcosViniciusdosSantos-9491 asked ·

Linux App Service - 'System.Drawing.GDIPlus' threw an exception. Unable to load shared library 'gdiplus' or one of its dependencies

Hello,

i´m trying to use System.Drawing in a linux web app, but i´m getting the exception below.

System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception.

System.DllNotFoundException: Unable to load shared library 'gdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgdiplus: cannot open shared object file: No such file or directory

I tried to execute the following commands in ssh shell, but still not working.

  • apt-get update

  • apt-get install -y --allow-unauthenticated libx11-dev

  • apt-get install -y --allow-unauthenticated libc6-dev

  • apt-get install -y --allow-unauthenticated libgdiplus


Running on Windows its working fine.

azure-webapps
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered ·

@MarcosViniciusdosSantos-9491, Apologies for the delay and any inconvenience with this! I completely understand this issue could be frustrating.

If you haven't tried this already, kindly add the code in Stack setting >> as Startup command "apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev && dotnet yourwebappname.dll"

You may checkout this document for more details on adding a startup script for Linux WebApp.


7301-linuxstartupcmd.jpg







If the issue still persist, to isolate, could you please check if this works locally in a Linux docker container and code issue (for cross platform version). Please check the approach outlined in this blog and see if it helps.
Just as a side-note, this post contains a third-party site for your reference & convenience to you only.


Kindly let us know if this helps or you need further assistance on this issue we will be more than happy to assist you.



linuxstartupcmd.jpg (50.3 KiB)
· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.