Developer Forum »
System.Drawing
42 posts

Hello

We are having some issues with site stability.

One template deals with a file archive which consists of a lot of images, so there's a lot of re-scaling going on. A feature that will rotate an image (using the Webnodes library) is also in place. The site will consistently hang if an image is rotated (by the request of a user).

In the course of our investigation we have been made aware of that the classes in System.Drawing can cause site stability issues. This is specifically mentioned under https://msdn.microsoft.com/en-us/library/system.drawing.aspx:

Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. For a supported alternative, see Windows Imaging Components.

Hence, I was wondering if Webnodes internally utilizes System.Drawing for re-scaling or rotation, or utilizes any libraries that themselves make use of this namespace.

Regards,

-Emil

120 posts

Interesting. Yes we are using components from System.Drawing. There are other libraries in WPF that we could use, but they seem to suffer some of the same problems. 

However, are you sure the problems are related to this? Do you have an exception with stacktrace indicating that System.Drawing is the problem?

At some point we had a recursive loop in the image resizing code. It could sometimes cause unexpected crashes of IIS. We have fixed this in a later build. What build are you running?

42 posts

There are no crashes, but while the rotation occurs the site remains unresponsive for other users as well. It's consistent. I am unsure however, if image file uploads and the following re-scaling operation also plays a part. Of course it's not a problem once the different image versions have been cached, but there are a lot of uploads and user actions going on.

Here is an also interesting article :)

http://weblogs.asp.net/bleroy/resizing-images-from-the-server-using-wpf-wic-instead-of-gdi

And apparently, if images are not properly Dispose()ed of it might cause serious harm (although I doubt that is the problem in our case):

http://www.asprangers.com/post/2012/03/23/Why-you-should-not-use-SystemDrawing-from-ASPNET-applications.aspx

EDIT: Build is 1597

42 posts

As a follow-up:

The system hangs only when performing rotations, not when re-scaling.

1