use AForge.Video.FFMPEG.dll to grab video thumbnail - asp.net

I am using AForge.Video.FFMPEG.dll to grab video thumbnail on website, it will be shown on webpage or other clients. I downloaded latest version of the dll and related native library into /bin folder and copied to system32 folder as well.
but when I compiled the project, it will told me:
"
Could not load file or assembly 'AForge.Video.FFMPEG.DLL' or one of its dependencies. The specified module could not be found.
"
I copied all DLLs
All DLLs are 32bit, not x64 bit.
I saw another article to introduce how to load native c or managed c++ library in asp.net, but doesn't work for me.
http://blogs.msdn.com/b/jorman/archive/2007/08/31/loading-c-assemblies-in-asp-net.aspx
My developing environment: Windows2012R2 VS2010
When I was compiling the project, compiler will throw above exception.
Thanks,
Sean

You must download and copy "postproc-52.dll" too.

ASP.Net loads native dlls - like the ones used in AForge.Video.FFMPEG - using Win32 API LoadLibrary which searches for the library in the folder the executable resides in.
When a library is loaded like this in a desktop application the folder the executable resides in is the bin folder but in ASP.Net the main executable is ASP.Net not your website/app, hence the folder LoadLibrary searches in is windows\system32 not bin.
You could just copy all the dlls to 'system32` but I wouldn't recommend doing so.. There are alternatives but I don't know much about them so I can't explain them, try searching google.

Related

Unable to load DLLs when starting up IIS Express hosted web project (VS2015)

Backgroud:
I am in the process of migrating a console application to be part of our existing web API project. All development work is done on Visual Studiod 2015 (with IIS Express). The application uses few third party datasource api DLLs to grab data from that datasource. All these DLLs are managed by our internal nuget package sources.
Issue:
Now the console application runs fine and can load up the those DLLs. I copied across the logic into my web project and added the DLLs via nuget. Solution builds but got the following error when starting up the web project:
Could not load file or assembly 'ABC.DLL' or one of its dependencies. The specified module could not be found.
Where ABC.DLL is one of the third party DLLs.
I have done the following:
Confirm ABC.DLL is in the bin folder of my web project
Changed target build platform of my web project to be x86 and unchecked "Use 64 bit version of IIS Express for websites and project" setting in VS2015 (the third party dll is 32-bit)
Ran dumpbin.exe on ABC.DLL's dependency and got XYZ.dll,MSVCR120.dll,KERNEL32.dll,MSVCP120.dll,mscoree.dll
Regarding to the last step, those dlls were all missing in the bin folder (but the last 4 DLLs should be in system32 win directory so shouldn't matter?)
As for XYZ.dll, it is another third party library and is located on C:\Program Files (x86)\XYZ\ folder. I manually copied it across to the web project bin folder (in fact copied across all Dlls inside XYZ folder) and still get the same issue.
Questions
What am I missing here? The console app obviously can load ABC.DLL but the web project can't. Appreciate it if you can tell me what to check next.
The error message from start up web page is not very useful, is there a way to find out where the web project is trying to load the third party DLLs?
Thank you in advance!
Simply adding external DLLs to your Bin folder is not a great idea. Files can disappear from this folder for various reasons, such as your team members deleting a seemingly useless DLL, or through Visual Studio clearing it. Also, the output DLLs from referenced projects in your solution, would end up there, and are replaced every time you build your project.
What you should do for third-party DLLs, is create some "dependencies" folder in, or close to, your project, and stick the DLLs in there. Then you should right-click on the project, select Add Reference, browse to that new "dependencies" folder, and add a reference to the DLL that way. This is similar to the way NuGet works; it keeps DLLs in their respective folders inside the packages folder, and adds references to those DLLs.
I finally found the issue and thanks for all the help, I had to disable shadow copying in VS (mentioned in 64 bit managed assembly with unmanaged dependencies not loading in IIS / ASP.NET MVC 4).

Why are c++ .dll not recognized in bin folder of asp.net webapp?

I create an ASP.NET Webapp with Razor syntax in Visual Studio 2015, in C#.
I have to use 20 third party native c++ dll files (most of them for image handing, libtiff-5.dll, libpng16-16.dll, etc...).
Even when I manually copy those dll files into the bin folder, the app would not run. The error is:
Could not load file or assembly 'managedDllWrapper.DLL' or one of its dependencies. The specified module could not be found.
But according to almost all hints in the internet, copying to bin folder should work.
When I copy the dlls into the C:\Windows folder, the webapp runs perfectly, but only locally on my machine.
Also, when I create a C# Console app, instead of a webapp, copying into the bin folder works fine.
Why doesn't it work for a webapp? How can I import those dlls?
I cannot reference them into Visual Studio to the project, as they are not a valid COM assembly.
the dlls are not imported in the code with dllimport, as I don't know the specific functions they provide. A managed dll wrapper uses the dlls.
Any ideas? Thanks!
I did not solve the problem one to one, but I circumvented the problem successfully:
By rewriting the c#/c++ wrapper with explicit dllimport, I adressed the dll files directly with path. Then, the dependent dll just have to be in the same folder as the referenced dll. This works also in web apps.

"Could not load file or assembly 'Microsoft.WindowsAzure.Storage" when AjaxToolKit in Bin folder

I'm learning ASP.net and working on a project in Visual Studio 2008. When I originally installed the AjaxControlToolKit I unzipped to a folder on my desktop, added a tab to the toolbox and browsed to the dll on my desktop. Everything worked fine until I realized the problem I had created.
I'm now trying to move the toolkit to my bin folder. I deleted the tab on my toolbox, deleted the reference to the AjaxControlToolKit on my desktop, unzipped to my bin folder and added a new tab with the correct path to the dll. When I run the project I receive an error:
"ASP.NET runtime error: Could not load file or assembly 'Microsoft.WindowsAzure.Storage' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
The problem only seems to occur when the ajax dll is located in my bin folder. I made another folder in my project and unzipped the toolkit there and everything worked fine. Any ideas?
I had same problem today and I got fixed it after checking every 'Microsoft.WindowsAzure.Storage reference in my all project solutions references or project solution references.
Must have to have same version of all, then it should be fine.
Try it and let me know.

QT: Can't deploy JPEG capability onto fresh windows machine

Jpegs are fine on my developer machine, but are not supported when i deploy my application to a fresh machine. all jpeg files used in stylesheets are still built with the application's resources, but are never displayed.
I tried deploying an "imageformats" folder, child of the executable folder, containing a "qjpeg4.dll" inside.
I tried linking against the qjpeg4.lib in my .pro file, WITH what's specified above.
still no good. Is there something in code I need to specify?
You need to deploy qt plugins with your application. Deploying Qt apps on Windows
This is just a guess, but I'm wondering if there is some dependency of the plugin that cannot be resolved on the virtual machine. Like you said, it is a simple file/folder thing, so it is probably finding the plugin dll. But maybe the dll is failing to load because it cannot resolve one if its dependencies.
The most likely culprit would be the C++ runtimes. Are you deploying those side-by-side in the application directory, or installed via the redistributable? If the former, the plugin may not be able to find them since it is in a different directory. To track this down, you could use the "Dependency Walker" and "SxSTrace.exe" tools.

How to correctly deploy Oracle.DataAccess.dll with ASP.NET app

We had some x64 / x86 trouble when we first deployed the Oracle.DataAccess.dll with our app on different servers with 64/32 bit Windows. Now that we figured out how we can get the app to reference the correct version, I still have trouble with a .dll file that is getting in the way during deployment.
Situation is as follows: I have one project in my solution that references Oracle.DataAccess. I set the "copy local" property to False, because on the server, I would like the app to use the .dll from the GAC or another folder (which would be the 64bit version instead of 32bit on development machine). The dll is not added to the project bin output folder, but it is copied to the web-app bin folder. When I deploy to our test-server, it uses the dll from the bin folder instead of the dll from the Oracle installation folder on the server (i.e. c:\oracle\odp.net\bin\4)
What can I do to NOT have the dll in the bin folder?
Keep in mind it only uses the dll for the reference. When the code actually calls the functions inside to connect to Oracle - .net uses the provider classes to get the usage (interface) for the Oracle client from the oracle installation directory.
That being said - in our applications - we just deploy the correct version in the bin folder based on the bit level of the OS. We have to do this since our apps support both Oracle and Sql - and the references would break for our Sql clients if the dll was not there.
One cause of this problem that we have found is when your web project does not directly reference Oracle.DataAccess.dll, but does reference another project that references it. This happens even when Copy Local is false on the referenced project.
The solution we found to work is to add the reference directly to your web project, and then set its reference to Copy Local to false.

Resources