
System.Drawing.SafeNativeMetho
ds threw an exception
If I create a simple
C#.NET project,
I can run it from cmdline and it works fine, run it from
a web and system.draw bombs out trying to get image
height and width. For testing, I did one with just
system.io to get basic file information, and it works
fine. I have set IIS to interact with the desktop and
gave aspnet account admin right for grins and still
nothing. This is my error:
Unhandled Exception: System.TypeInitializationException:
The type initializer
for "System.Drawing.SafeNativeMethods" threw an
exception. --->
System.Runtime.InteropServices.ExternalException: Failed
to create system events window thread.
at Microsoft.Win32.SystemEvents.EnsureSystemEvents
(Boolean requireHandle, Boolean throwOnRefusal)
at Microsoft.Win32.SystemEvents.InvokeOnEventsThread
(Delegate method)
at System.Drawing.SafeNativeMethods.Initialize()
at System.Drawing.SafeNativeMethods..cctor()
--- End of inner exception stack trace ---
at
System.Drawing.SafeNativeMethods.GdipCreateBitmapFromFile
(String filename, IntPtr& bitmap)
at System.Drawing.Bitmap..ctor(String filename)
at ABCImages.ScaleImages.Main(String[] args)