views:

56

answers:

2

I'm running a web application under IIS that we draw graphs with that are sent to the clients. We were previously running under iis6, while migrating to 2008 ( iis7 ) we have encountered some very weird issues with the graphing. I stumbled across the msdn docs for GDI+ stating that "GDI+ functions and classes are not supported for use within a Windows service." I suspect that my issues are probably related to further isolation of services http://msdn.microsoft.com/en-us/library/ms533798%28VS.85%29.aspx

My question is how the heck are we supposed to draw graphics? Raw GDI? OpenGL - but doesn't that still require a DC?

A: 

I had asked a similar question:

http://stackoverflow.com/questions/2562699/why-not-use-gdi-from-asp-net

I ended up switching to the LeadTools libraries.

Of course, you can choose any library that is not device dependent. GDI+ is depending on a device context which gives it a physical device to base it's graphics on. However, when running as a service, the graphics adapter is probably not available for use as it would be in a desktop environment.

You could also write your own graphics routines which draw to a bitmap. A bitmap is simply raw memory arranged in a certain format.

I'll look into the leadtools libraries. Really I guess what I need is some library to accomplish graphics drawing in a device independent manner.
Zac
Zac
Try version 15+. Also depends on what you are doing with their libraries. There is the capability of interop between GDI+ and Leadtools. What I did was to make an out-of-process server (just spawned a separate .exe that used Leadtools to do the graphics) then read the resulting jpeg file from within the asp.net application.
LeadTools was much faster (don't know exact percentage) than GDI+ at the image processing routines I was running. So that may be a plus too.
A: 

Not 100% on your particular situation given the details; but why not perform your graphics rendering with a simple asp.net application? You can use the System.Drawing namespace which wraps GDI+

If you need just barebones functionality for rendering graphics and delivering to clients over HTTP, you can also use an HTTPHandler

Gurdas Nijor
Our drawing is done in native C++ libraries. And as you pointed out Sysem.Drawing uses GDI+ under the hood - against the MSDN recommendations.
Zac