Reputation: 139
There are two symptoms of what I believe is the same issue.
I've installed GhostScriptSharp using Nuget and I'm running it locally on a 32-bit maching in the Azure Development Fabric. Everything is working wonderfully.
When I deploy to Azure, which is 64-bit, I'm getting the following error message.
Unable to load DLL 'gsdll32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
There are two issues here as I can tell
Are there any recommendations to get this working on the Azure deployments?
Upvotes: 2
Views: 1706
Reputation: 93551
Just had to solve this on an Azure website deployment for a test site. We only use GhostScriptSharp for the thumbnailing features and have not figured out how to do the same with Ghostscript.NET as practical examples are light on the ground.
The error message is slightly misleading. The file is not missing, it just does not have read/write access to the folder in which the DLL files were located (e.g. your BIN folder).
If you were running on a VM you could give read/write access to your BIN folder (slight security problem), but on free Azure websites you do not have that control.
Our solution was to place the gsdll32.dll and gsdll64.dll files into the App_Data
folder (which already has read/write access) and add that folder to the places searched for DLLs using the Win32 kernel SetDllDirectory
function.
e.g. declare it using
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
Then, before calling the GhostscriptSharp methods, e.g. from within your controller method, add the App_Data
folder to the DLL search paths using:
SetDllDirectory(Server.MapPath("~/App_Data/"));
After this it just started working again.
Upvotes: 4
Reputation: 36
It is possible that you are missing some windows runtime DLLs that exist on the development machine. These would need to be included in your deployment to Azure.
Upvotes: -1