簡體   English   中英

無法加載文件或程序集“AxInterop.WMPLib”或其依賴項之一。 參數不正確。

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

我有一個庫 AXInterop.WMPLib,它讓我發瘋。 這是我收到的錯誤。 我沒有使用任何其他依賴項。

堆棧跟蹤:

[FileLoadException: 無法加載文件或程序集“AxInterop.WMPLib”或其依賴項之一。 參數不正確。 (來自 HRESULT 的異常:0x80070057 (E_INVALIDARG))]

[FileLoadException:無法加載文件或程序集“AxInterop.WMPLib,版本=1.0.0.0,文化=中性,PublicKeyToken=null”或其依賴項之一。 參數不正確。 (來自 HRESULT 的異常:0x80070057 (E_INVALIDARG))]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean for Introspection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean for Introspection, Boolean抑制SecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean for Introspection, Boolean SuppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean for Introspection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean for Introspection) +16 System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException:無法加載文件或程序集“AxInterop.WMPLib,版本=1.0.0.0,文化=中性,PublicKeyToken=null”或其依賴項之一。 參數不正確。 (來自 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): 無法加載文件或程序集“AxInterop.WMPLib,版本=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依賴項之一。 參數不正確。 (來自 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

我假設您在 Windows 客戶端(XP、Vista 或 7)上開發此應用程序,然后將其部署到 Windows Server(2008、2008 R2 等)

Windows Media Player 是 Windows Server 上的可選組件(不同於 Windows 客戶端,例如 Windows 7),因此您必須啟用它(作為桌面體驗角色服務的一部分),

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

之后,AxInterop.WMPLib 應該能夠找到其依賴項(Windows Media Player 中的本機庫)。

我在 Windows 10 專業版中遇到了同樣的錯誤。 問題是我使用自定義構建事件在另一個路徑中進行編譯,而我沒有將庫添加到項目編譯文件夾中。

因此,請務必將AxInterop.WMPLib.dllInterop.WMPLib.dll添加到項目文件夾中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM