We got ImageMagick working ages ago by putting the executables (convert.exe, identify.exe) in cloud storage, then when the application needed to use them, it would download them to local scratch storage (I'll do a bigger post on this later). This works really well on my local machine but upon testing on actual Windows Azure convert.exe and identify.exe stopped working, quoting:
The application has failed to start because its side-by-side configuration is incorrect.. Please see the application event log ...
My first thought was to follow the application event log, so I grabbed Azure Diagnostics Manager [http://www.cerebrata.com/products/AzureDiagnosticsManager/Default.aspx] and added some code to my WorkerRole.cs/WebRole.cs OnStart...
DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();
dmc.WindowsEventLog.DataSources.Add(Constants.ApplicationName);
dmc.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
DiagnosticMonitor.Start("DataConnectionString", dmc);
...and found nothing! I couldn't get the event log and after a little bit of playing around I decided to give up path! The problem is that every time you do small changes to azure the deploy process takes AGES - like 5 minutes or so. So trying little things and failing them then having to wait 5 minutes between can get very frustrating. I'm sure if I read the full how-to post (http://blog.toddysm.com/2010/05/collecting-event-logs-in-windows-azure.html) I would have worked it out but I had a feeling that the event log wouldn't tell me much regardless.
So back on track I looked into the side-by-side error and found some information about it. Basically side-by-side errors mean that some config/assemblies are missing (http://msdn.microsoft.com/en-us/library/ms235342.aspx). So I started along the long path of finding the missing references to ImageMagick. By the way, the actual problem is that the VS2008 C++ Redistrib packages didn't exist on Azure whereas they existed on my system (ImageMagick download page states this at the very bottom http://www.imagemagick.org/www/binary-releases.html). I don't think I can just install them on azure so I went about the problem by gathering all the required assemblies.
So, to investigate side-by-side issues you have to use the "sxstrace" tool. I set up a new blank Windows 7 VM to ensure vs2008 redistributable packages weren't there, then ..
1. Run cmd elevated (Start -> type "cmd" -> right click on cmd -> Run as Adminsitrator).
2. cd into your executable directory
3. Run "sxstrace trace -logfile:sxstrace.ctl" (without quotes)
4. In another cmd, run your side-by-side failing program (identify.exe in my case)
5. Press enter to stop tracing for sxstrace
6. The trace is a binary file that needs to be parsed. Parse it: sxstrace parse -logfile:sxstrace.ctl -outfile:sxstrace.txt
7. Open up sxstrace.txt and you'll find your problem.
In my case, identify.exe required a couple of dlls and some .manifest files. You end up having to copy required manifests from c:\windows\winsxs\manifests to your executable folder then grabbing all those dlls. Run sxstrace again (as above) to find more problems. Here's what I ended up with to get identify.exe and convert.exe working (my wordpress images directory isn't working so the filenames are just given below):
convert.exe
identify.exe
identify.exe.manifest (not sure if this is needed)
Microsoft.VC90.OpenMP.MANIFEST (this was renamed from the respective manifest file in c:\windows\winsxs\manifests as I was looking specifically for this name from the sxstrace log)
mscvm90.dll
msvcp90.dll
msvcr90.dll
vcomp90.dll
x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest
Happy to provide more details if anyone needs.
// Redirect Event Logs to your storage accountDiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();dmc.WindowsEventLog.DataSources.Add(Constants.ApplicationName);dmc.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);DiagnosticMonitor.Start("DataConnectionString", dmc) // Redirect Event Logs to your storage accountDiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();dmc.WindowsEventLog.DataSources.Add(Constants.ApplicationName);dmc.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);DiagnosticMonitor.Start("DataConnectionString", dmc);
No comments:
Post a Comment