DllNotFoundException

  • Thread starter Thread starter Aaron Stubbendieck
  • Start date Start date
A

Aaron Stubbendieck

Hello,
I have an asp.net script that references system.drawing and I am receiving
the following the error when using system.drawing.bitmap:

Exception Details: System.DllNotFoundException: Unable to load DLL
(gdiplus.dll).
[DllNotFoundException: Unable to load DLL (gdiplus.dll).]
System.Drawing.SafeNativeMethods.GdiplusStartup(IntPtr& token,
StartupInput& input, StartupOutput& output) +0
System.Drawing.SafeNativeMethods.Initialize() +117
System.Drawing.SafeNativeMethods..cctor() +155

[TypeInitializationException: The type initializer for
"System.Drawing.SafeNativeMethods" threw an exception.]
System.Drawing.SafeNativeMethods.GdipCreateBitmapFromScan0(Int32 width,
Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
+0
System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat
format) +76
ASP.graphics_aspx.__Render__control1(HtmlTextWriter __output, Control
parameterContainer) in file.aspx:9
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
System.Web.UI.Page.ProcessRequestMain() +1929

On the same system I have a C# application that uses system.drawing and it
works with no problem. I've tried reinstalling the framework with no avail.

Any suggestions on how to fix this?

Thanks,
Aaron Stubbendieck
 
Hi,
Strange. GDI+ is part of XP 2003, OS. From MSDN :
"GDI+ is the portion of the Windows XP operating system or Windows
Server 2003 operating system that provides two-dimensional vector
graphics, imaging, and typography. GDI+ improves on Windows Graphics
Device Interface (GDI) (the graphics device interface included with
earlier versions of Windows) by adding new features and by optimizing
existing features. " it's not .Net or COM object just native windows
DLL.

Usually when something working with win app and not with web apps it’s
all about security reasons. try to use <Identity impersonate="true" User
name="" Password=""> where user name will be set with your user, just
for testing - it's security hole.

Take a look also at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/
gdiplus/gdiplus.asp


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
I tried using impersonate with the local admin account (on the server) with
and the script executed perfectly. When I turned impersonation back off,
the script stopped working, so it must be a permissions problem. The
inetpub directoy has Read & Execute, List, and Read permissions for the
asp.net account. The actual gdiplus.dll in
%systemroot%\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.0.0_x
-ww_8d353f13 and
%systemroot%\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.10.0_
x-ww_712befd8 only have permissions for Administrators and System, I tried
giving the IIS guest accouts privileges with no success.

I've also tried running aspnet_regiis.exe -i, with nothing different
happening.

Any suggestions on what to try next?

Thanks,
Aaron Stubbendieck
 
Aaron Hi,

The default asp.net user doesn’t have permissions to activate COM
objects. Setting permissions of directories won’t help you. You need to
create user with minimal permissions but with the ability to activate
COM objects. You might use the following link to find out what rights
that user should have :
msdn.microsoft.com/library/en-us/dnnetsec/html/ThreatCounter.asp

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
Back
Top