简体   繁体   中英

Could not load file or assembly 'AxInterop.WMPLib' or one of its dependencies. The parameter is incorrect.

I have one library AXInterop.WMPLib and it is driving me crazy. this is the error that I receive. I am not using any other dependencies.

Stack Trace:

[FileLoadException: Could not load file or assembly 'AxInterop.WMPLib' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]

[FileLoadException: Could not load file or assembly 'AxInterop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'AxInterop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +258
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Could not load file or assembly 'AxInterop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456

I assume you develop this application on Windows client (XP, Vista, or 7), and then deploy it to a Windows Server (2008, 2008 R2 and so on)

Windows Media Player is an optional component on Windows Server (different from Windows client such as Windows 7), so you will have to enable it (as part of Desktop Experience role service),

http://technet.microsoft.com/en-us/library/cc772567.aspx

After that AxInterop.WMPLib should be able to locate its dependencies (native libraries in Windows Media Player).

I had the same error in Windows 10 Pro. The problem was that I was using custom Build Events to compile in another path, and I was missing to add the libraries into the project compilation folder.

So, be sure to add the AxInterop.WMPLib.dll and Interop.WMPLib.dll into the project folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question Could not load file or assembly 'EntityFramework.SqlServer' or one of its dependencies. The parameter is incorrect Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The parameter is incorrect Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format Could not load file or assembly 'MyLibrary' or one of its dependencies. An attempt was made to load a program with an incorrect format Could not load file or assembly xxx or one of its dependencies. An attempt was made to load a program with an incorrect format. Could not load file or assembly 'xxx' or one of its dependencies. An attempt was made to load a program with an incorrect format BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format Could not load file or assembly 'MWArray' or one of its dependencies. An attempt was made to load a program with an incorrect format Could not load file or assembly '...' or one of its dependencies. An attempt was made to load a program with an incorrect format Could not load file or assembly 'sapnco' or one of its dependencies. An attempt was made to load a program with an incorrect format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM