2
votes

On Windows Server 2003 32-bit, IIS 6.0 I currently have a working ASP classic page successfully using a VB6 DLL to render text as images using many varied fonts (the DLL references GDI+ to render a jpeg of the text in the specified font, etc.):

[working VBScript calling out to a VB6 DLL which calls to GDI+]

Set ig = Server.CreateObject("MyCo.ImageGenerator") 'the DLL
ret = ig.GenerateImage(text, font, size, path, color, italics, bold)

I need to transfer this site to a Windows 2008 or later server. On the new server, GDI+ has an error, specifically at this line in the VB6 DLL code:

lRes = GdipCreateBitmapFromHBITMAP(pict.Handle, 0, lBitmap) 'ret 2 (0 is success)

When I call the same DLL function (i.e. GenerateImage) from a Windows Forms App on the new server, it generates the image with no problem. I don't think it's a permissions issue because:

  1. the target folder for generated images that the ASP VBScript directs the DLL to has full permissions for "Everyone" (for setup testing only) and
  2. logging code in the DLL can write to the target directory
  3. EDIT I (later) gave the Network Service user (the app pool account) read / read-execute permission without seeing a change in behavior (as suggested in a comment by @Lankymart).

I'm confused why the DLL works fine from a Windows Forms app call, but not from within IIS 7.

1
Do the handles you pass to the function look ok? - That said the difference between the forms app & IIS is that the latter is a service & GDI+ has "don't use from a service/not supported/unexpected behavior" warnings when used in that scenario, unfortunately you may simply be seeing a manifestation of that. - Alex K.
What about permissions to use various fonts etc not just execute the DLL? Does the AppPool Identity have the required permission to access fonts in the system folder? Wouldn't assume it's not permission related. - user692942
@AlexK. The handle looks ok (it's a long integer value). How can I allow the service to call GDI+? Is there some way to override that behavior? - jbobbins
@Lankymart I gave the Network Service user read and read/execute access to the font directory (and specific access to a font that is used by default) with no change in behavior. - jbobbins

1 Answers

0
votes

Hi IIS>Advanced Properties> Enable 32-Bit Application> is True check please and windows server x64 then dll register for C:\Windows\SysWOW64