无法加载文件或程序集“合并”或其依赖项之一

问题描述 投票:0回答:1

我正在尝试启动一个iis站点(asp.net mvc),该站点在进行更改之前运行良好。我引用了一些nuget-packages(没什么特别的,但是其中一些引用了netstandard),并且做了一些小的代码更改。现在尝试连接到站点时,此堆栈跟踪出现错误Could not load file or assembly 'Merged' or one of its dependencies

[FileLoadException: Could not load file or assembly 'Merged' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   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) +225
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
   System.Reflection.Assembly.Load(String assemblyString) +34
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48

[ConfigurationErrorsException: Could not load file or assembly 'Merged' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +725
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +247
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +157
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +319
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +170
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +820

[HttpException (0x80004005): Could not load file or assembly 'Merged' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

我还提供程序集绑定日志:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Merged
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Merged | Domain ID: 3
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:/Proj/Test/FmsFront/
LOG: Initial PrivatePath = C:\Proj\Test\FmsFront\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Proj\Test\ProjFront\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/root/fcbbd808/fa43678c/Merged.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/fcbbd808/fa43678c/Merged/Merged.DLL.
LOG: Attempting download of new URL file:///C:/Proj/Test/ProjFront/bin/Merged.DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

我环顾四周,试图找到名称为“ Merged”的dll。但这似乎是部分程序集的名称。同样,在我的实际代码开始之前,似乎抛出了此错误。我尝试还原软件包。同样,它在本地计算机上也可以正常工作,但是在另一台服务器上它会失败。

如何解决此错误?

c# asp.net .net-assembly
1个回答
0
投票

所以最后我弄清楚了。问题是我安装的软件包之一带有netcoreapp依赖项。但是我的应用程序是netframework。因此,没有将此netcoreapp库依赖项放到二进制目录中,并且无法加载该库。我在应用程序的二进制文件夹中找到了此Merged.dll,并将其删除。之后,它就可以工作。

现在,我正在与该软件包作者联系,以了解为什么将netcoreapp依赖项放入netframework应用程序中。

© www.soinside.com 2019 - 2024. All rights reserved.