AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Accord.Video.FFMPEG in IIS? -Could not load file or assembly

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

Accord.Video.FFMPEG in IIS? -Could not load file or assembly

Postby Moongoat » Tue Feb 14, 2017 3:54 pm

I'm trying to get Accord.Video.FFMPEG to work in IIS, but I keep getting the error:

Could not load file or assembly 'Accord.Video.FFMPEG' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I've tried a bunch of different things, like copying the Accord.Video.FFMPEG files and other codec files to system32, and SysWOW64 - tried compiling both x86 and x64, debug and release, adding config to my web.config, but nothing seems to work.

I've created 2 sample projects. One I made as a winform, which just contains the following:

Code: Select all
   var reader = new VideoFileReader();
   reader.Open(@"C:\Camarilla\Video\vid.mp4");

   var framecount = reader.FrameCount;
   var frameRate = reader.FrameRate;


Which worked instantly after adding the Accord.Video.FFMPEG nuget.

I then made a new ASP.Net Web Application, chose the Web API template, configured it to run under normal IIS (instead of IIS express) added the Accord.Video.FFMPEG nuget and tried to run the application.

This is the full log:

Could not load file or assembly 'Accord.Video.FFMPEG' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Accord.Video.FFMPEG' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Accord.Video.FFMPEG' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = Accord.Video.FFMPEG
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Accord.Video.FFMPEG | Domain ID: 4
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Video/VideoTest.Web/Videotest.Web/Videotest.Web/
LOG: Initial PrivatePath = C:\Video\VideoTest.Web\Videotest.Web\Videotest.Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Video\VideoTest.Web\Videotest.Web\Videotest.Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/videotest.web/93651fd8/923131f1/Accord.Video.FFMPEG.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/videotest.web/93651fd8/923131f1/Accord.Video.FFMPEG/Accord.Video.FFMPEG.DLL.
LOG: Attempting download of new URL file:///C:/Video/VideoTest.Web/Videotest.Web/Videotest.Web/bin/Accord.Video.FFMPEG.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.


Stack Trace:


[BadImageFormatException: Could not load file or assembly 'Accord.Video.FFMPEG' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +234
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +108
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +25
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +49

[ConfigurationErrorsException: Could not load file or assembly 'Accord.Video.FFMPEG' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +772
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +259
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +163
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +230
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +76
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +343
System.Web.Compilation.BuildManager.ExecutePreAppStart() +176
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +734

[HttpException (0x80004005): Could not load file or assembly 'Accord.Video.FFMPEG' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716


I've added the two sample projects to my dropbox: (because the forum wouldnt let me upload files bigger than 256 kb)
https://dl.dropboxusercontent.com/u/316 ... eoTest.zip

Can someone please tell me how to solve this? And how to get this library running in IIS? Or if someone could post a sample project that does working under IIS, that'd be great.

Thanks!

I'm using Visual Studio 2015 community edition update 3, and my computer is running Windows 10, x64.
The actual application that I want this to work in will run on Windows Server 2012 R2, AMD64
Moongoat
 
Posts: 2
Joined: Tue Feb 14, 2017 3:22 pm

Re: Accord.Video.FFMPEG in IIS? -Could not load file or asse

Postby andrew.kirillov » Tue Feb 14, 2017 7:57 pm

H
Moongoat wrote:I'm trying to get Accord.Video.FFMPEG to work in IIS, but I keep getting the error:

Sounds good. Please, direct your question to Accord framework community. If you've noticed, this forum is about AForge.NET Framework.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Accord.Video.FFMPEG in IIS? -Could not load file or asse

Postby Moongoat » Wed Feb 15, 2017 8:49 am

Ah sorry.

It was a long day trying to fix this... I started with the Aforgenet VideoFileReader class, and when I could not get that to work I switched to the Accord.Video.FFMPEG framework.

However, I has pretty much the exact same problem using AForge.Video.FFMPEG. Are there any tutorials or samples of AForge.Video.FFMPEG in IIS?

I'll reproduce my issue using AForge.Video.FFMPEG and make a new post.
Moongoat
 
Posts: 2
Joined: Tue Feb 14, 2017 3:22 pm

Re: Accord.Video.FFMPEG in IIS? -Could not load file or asse

Postby andrew.kirillov » Wed Feb 15, 2017 10:28 am

Personally I never tried AForge.NET Framework from web applications, so can not advice much. However, the problem you have might be a common one and Googling may help. Here are few things.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to AForge.NET Framework

cron