Deploy GdPicture on IIS 7

General discussions about GdPicture.NET.
Post Reply
lordnedox
Posts: 16
Joined: Sun Oct 10, 2010 5:13 am

Deploy GdPicture on IIS 7

Post by lordnedox » Wed Feb 08, 2012 7:42 am

hi,
i'm trying to do a TIF to JPEG conversion on the server side, using a web service.
Everything (GdPicture.dll and all the unmanaged DLLS) is inside the Bin folder of my web project.

Initially I got the error:
"The version of GdPicture.NET.image.gdimgplug.dll is invalid. Please, copy last version of this dll into your application directory at: C:\Windows\SysWOW64\inetsrv"
So my understanding is that IIS is looking for the DLLs in that folder. Copying them in the folder and restarting IIS makes it works.

The question is, is there a way to make IIS locate the DLLs inside the Bin folder of my project, so that when I make a setup I don't have to copy GdPicture Dlls inside Windows system folders, having to check the operating system (32 or 64bit) and the application pool (again could be 32-64, depends on the customer environment) ?
Is there a best practice to do these kind of deployments?

User avatar
Loïc
Site Admin
Posts: 5699
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Deploy GdPicture on IIS 7

Post by Loïc » Wed Feb 08, 2012 1:08 pm

Hello,

If you copy all required dlls in the Bin folder it should work. Have you tried that ?

Kind regards,

Loïc

lordnedox
Posts: 16
Joined: Sun Oct 10, 2010 5:13 am

Re: Deploy GdPicture on IIS 7

Post by lordnedox » Thu Feb 09, 2012 6:34 am

Yes that was my first try and there I got the error I reported in my first post.
The problem is not on GdPicture.DLL, which can be found, but in other DLLs like "GdPicture.NET.image.gdimgplug.dll " which are searched at runtime.
Do you have any example that should work (with everything inside the Bin folder)? It would be really helpful.
May it be some kind of conflict over 32/64 bit, or read permission in the bin folder? (anyway, i tried to deploy both 32 bit and 64 bit with same results)

thanks
regards

User avatar
Loïc
Site Admin
Posts: 5699
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Deploy GdPicture on IIS 7

Post by Loïc » Thu Feb 09, 2012 11:44 am

Hello,

I think we have solved this issue for the next minor release. Waiting for, you can try to load the runtime dlls by using the LoadLibrary method on each required dlls.

You can also contact us via http://support.gdpicture.com to get a beta version.

Hope this helps!

Kind regards,

Loïc

lordnedox
Posts: 16
Joined: Sun Oct 10, 2010 5:13 am

Re: Deploy GdPicture on IIS 7

Post by lordnedox » Thu Feb 09, 2012 1:48 pm

Hi Loic,
thanks for your prompt reply.
As this is quite urgent, I would like to get this beta version. Don't know exactly what to do in support area, I opened the ticket #17766.

thanks
regards

scheffler
Posts: 3
Joined: Tue Mar 05, 2013 2:31 pm

Re: Deploy GdPicture on IIS 7

Post by scheffler » Wed Mar 06, 2013 11:55 pm

Has this been resolved? I'm running into the same issue with 9.3. I can stuff in a manual call to LoadLibrary, I guess, but that seems hackish.

scheffler
Posts: 3
Joined: Tue Mar 05, 2013 2:31 pm

Re: Deploy GdPicture on IIS 7

Post by scheffler » Thu Mar 07, 2013 4:21 am

Posting a solution here in case someone else trips over this. First, for asp.net deployments, it's important to remember that the bin directory of your web app is not really where the site is run from. The DLLs get shadow copied by iis, so even though you have put the C++ native DLLs alongside the managed redistributables, the LoadLibrary calls won't find them. See here: http://stackoverflow.com/a/861687/3489.

A very simple fix for this is to add a small block of code to the Application_Start as follows:

Code: Select all

            
string oldpath = Environment.GetEnvironmentVariable("Path");
string newpath = string.Format("{0};{1}", oldpath, Server.MapPath("~/bin"));
Environment.SetEnvironmentVariable("Path", newpath);
Now, as long as you've been sure to copy any native C++ redist DLLs to the ~/bin folder of your site, you'll be good to go.

Hope this helps someone.

User avatar
Loïc
Site Admin
Posts: 5699
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Deploy GdPicture on IIS 7

Post by Loïc » Thu Mar 07, 2013 1:22 pm

Hello,

Thank you very much for posting this solution.
Anyway GdPicture as an internal library locator mechanism that should have found the unmanned dll by itself. So, *in theory*, this workaround should not be required.
If the error message was "The version of GdPicture.NET.image.gdimgplug.dll is invalid" as stated on the initial post of this thread, this is because of a version conflict. Probably because another version of the unmanaged dll was available on a folder defined on the Path environment of the system.

scheffler
Posts: 3
Joined: Tue Mar 05, 2013 2:31 pm

Re: Deploy GdPicture on IIS 7

Post by scheffler » Thu Mar 07, 2013 2:59 pm

Interesting. Can you tell me where all the installer copies the image plugin DLL? I had removed from my local system path and references to GDPicture.net installation folders to emulate what would be available as part of a server deployment. If you're dropping the redist DLLs into system32 or some other std path location then that would be another factor.

Note that this was failing for me on my development machine when the only version of GDPicture.NET I had installed anywhere was 9.3, and still it was unable to find the image plugin.

User avatar
Loïc
Site Admin
Posts: 5699
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Deploy GdPicture on IIS 7

Post by Loïc » Thu Mar 07, 2013 4:12 pm

where all the installer copies the image plugin DLL
Only in the redist folder. It also modifies the Path environment variable to add this folder.
Note that this was failing for me on my development machine when the only version of GDPicture.NET I had installed anywhere was 9.3, and still it was unable to find the image plugin.
Which error message do you got exactly? Again, this thread was initially talking about dll version mismatch and not about not found dll. Both situations are totally different.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests