GVKun编程网logo

无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。清单定义与程序集引用不匹配

12

想了解无法加载文件或程序集“Newtonsoft.Json”或其依赖项之一。清单定义与程序集引用不匹配的新动态吗?本文将为您提供详细的信息,此外,我们还将为您介绍关于.net–无法加载文件或程序集’N

想了解无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。清单定义与程序集引用不匹配的新动态吗?本文将为您提供详细的信息,此外,我们还将为您介绍关于.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一、.net – 无法加载文件或程序集“Antlr3.Runtime”或其依赖项之一、.net – 无法加载文件或程序集“AutoMapper”或其依赖项之一、asp.net – 无法加载文件或程序集“log4net”或其依赖项之一的新知识。

本文目录一览:

无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。清单定义与程序集引用不匹配

无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。清单定义与程序集引用不匹配

搜索后我尝试过的事情:

  1. 在Web.Config中,对旧版本进行绑定:

    <dependentAssembly><assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.1.0" />

  2. 编辑我的.csproj文件,以确保只有一个Newtonsoft参考

        <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">       <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>       <SpecificVersion>False</SpecificVersion>       <Private>True</Private>    </Reference>
  1. 在我的计算机上搜索每个Newtonsoft.Json.dll并删除每个非6.0.1版本并删除我的temp文件夹的内容

  2. 在nuget Manager控制台中修复/重新安装软件包

它可以成功构建,但是在转到站点时出现错误。

编辑

好的,因此我尝试像每个nuget软件包一样重新安装,似乎已添加回4.5版本的newtonsoft.json.dll,但我遇到了相同的错误。我项目的目标框架是.NET
4.5.1,这是我现在得到的堆栈跟踪:

“ /”应用程序中的服务器错误。

无法加载文件或程序集Newtonsoft.Json或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(从HRESULT异常:0x80131040

说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中起源的更多信息。

异常详细信息:System.IO.FileLoadException无法加载文件或程序集Newtonsoft.Json或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(从HRESULT异常:0x80131040

源错误:

当前Web请求的执行期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。

程序集加载跟踪:以下信息有助于确定为什么Newtonsoft.Json无法加载程序集。

    === Pre-bind state information ===    LOG: DisplayName = Newtonsoft.Json    (Partial)    WRN: Partial binding information was supplied for an assembly:    WRN: Assembly Name: Newtonsoft.Json | Domain ID: 2    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:/users/user/documents/visual studio 2013/Projects/foo/bar/    LOG: Initial PrivatePath = c:\users\user\documents\visual studio 2013\Projects\foo\bar\bin    Calling assembly : (Unknown).     ===    LOG: This bind starts in default load context.    LOG: Using application configuration file: c:\users\user\documents\visual studio 2013\Projects\foo\bar\web.config    LOG: Using host configuration file: C:\Users\user\Documents\IISExpress\config\aspnet.config    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json.DLL.    LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json/Newtonsoft.Json.DLL.    LOG: Attempting download of new URL file:///c:/users/user/documents/visual studio 2013/Projects/foo/bar/bin/Newtonsoft.Json.DLL.    LOG: Using application configuration file: c:\users\user\documents\visual studio 2013\Projects\foo\bar\web.config    LOG: Using host configuration file: C:\Users\user\Documents\IISExpress\config\aspnet.config    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.    LOG: Redirect found in application configuration file: 4.5.0.0 redirected to 6.0.1.0.    LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed    LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json.DLL.    LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json/Newtonsoft.Json.DLL.    LOG: Attempting download of new URL file:///c:/users/user/documents/visual studio 2013/Projects/foo/bar/bin/Newtonsoft.Json.DLL.    WRN: Comparing the assembly name resulted in the mismatch: Major Version    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

堆栈跟踪:

    [FileLoadException: Could not load file or assembly ''Newtonsoft.Json'' or one of its dependencies. The located assembly''s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]    [FileLoadException: Could not load file or assembly ''Newtonsoft.Json, Version=6.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'' 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.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 ''Newtonsoft.Json, Version=6.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'' 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) +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, Boolean& isRefAssemblyLoaded) +285           System.Web.Compilation.BuildManager.ExecutePreAppStart() +153           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 ''Newtonsoft.Json, Version=6.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'' 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) +9913572           System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101           System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408

答案1

小编典典

好的,我想我现在可以开始工作了。我删除了机器上所有不是我可以找到的最新版本的Newtonsoft.Json.dll,确保在NuGet中拥有最新版本,并进行构建,并确保它是bin文件夹中的最新版本,并且我将更改保留在web.config和.csproj中。现在,我遇到另一个错误,因此它必须正在工作。

.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一

.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一

这一个错误让我疯了.

我在我的一个名为BaseServices的类库中安装了SendGrid NuGet包,它依赖于Newtonsoft.Json v7.0.1,所以它将它安装在我的packages文件夹中并引用它.

在类库中,我有这个绑定重定向:

<dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>

在ASP.NET MVC应用程序的web.config中,即使用我的类库的客户端应用程序,我有一个小于v6版本的程序集绑定重定向指向Newtonsoft.Json库的v6,如下所示:

<dependentAssembly>
 <assemblyIdentity name="Newtonsoft.Json" culture="neutral"
              publicKeyToken="30ad4fe6b2a6aeed" />
  <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>

当我运行我的电子邮件发送BaseServices库中的代码时,我收到此错误:

The thread 0x1a4c has exited with code 0 (0x0).
System.IO.FileLoadException: Could not load file or assembly
‘Newtonsoft.Json,Version=7.0.0.0,Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The
located assembly’s manifest deFinition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) File name:
‘Newtonsoft.Json,
PublicKeyToken=30ad4fe6b2a6aeed’ at
SendGrid.Helpers.Mail.Mail.Get() at
BaseServices.EmailService.SendAsync(EmailMessage message) in
MyFolder\BaseServices\EmailService.cs:line 39

=== Pre-bind state information === LOG: displayName = Newtonsoft.Json,PublicKeyToken=30ad4fe6b2a6aeed
(Fully-specified) LOG: Appbase = file:///MyFolder/Web/ LOG: Initial
PrivatePath = MyFolder\Web\bin Calling assembly : SendGrid,
Version=7.0.3.0,PublicKeyToken=4f047e93159395ca.
=== LOG: This bind starts in default load context. LOG: Using application configuration file: MyFolder\Web\web.config LOG: Using
host configuration file:
C:\Users\computer\Documents\IISExpress\config\aspnet.config LOG: Using
machine configuration file from
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Newtonsoft.Json,
Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting
download of new URL
file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET
Files/root/ef9cacdf/e639667a/Newtonsoft.Json.DLL. LOG: Attempting
download of new URL
file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET
Files/root/ef9cacdf/e639667a/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG:
Attempting download of new URL
file:///MyFolder/Web/bin/Newtonsoft.Json.DLL. WRN: Comparing the
assembly name resulted in the mismatch: Major Version ERR: Failed to
complete setup of assembly (hr = 0x80131040). Probing terminated.

解决方法

您的解决方案中有2个不同版本的JSON.NET库.要解决此问题,您应该将它们升级到最新版本.跟着这些步骤:

>开放式解决方案
>右键单击解决方案名称
>选择管理解决方案的Nuget包
>从菜单中选择更新
>更新JSON.NET包

这将解决您的问题.

.net – 无法加载文件或程序集“Antlr3.Runtime”或其依赖项之一

.net – 无法加载文件或程序集“Antlr3.Runtime”或其依赖项之一

我找到了一个类似的问题,但没有解决我的问题.

Could not load file or assembly ‘Antlr3.Runtime’ or one of its
dependencies. This assembly is built by a runtime newer than the
currently loaded runtime and cannot be loaded

我只在IIS中收到此错误.我正在尝试部署到IIS 7.5.我将应用程序池设置为4.0,Integrated.

早些时候一切都很好.安装框架4.5 VS 2012 Express后,我使用MachineKeyCryptography获得了异常.所以我卸载了4.5框架和VS 2012,因为这个混乱正在发生.

我得到的例外情况如下.

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 ‘Antlr3.Runtime’ or one of its dependencies. This assembly
is built by a runtime newer than the currently loaded runtime and
cannot be loaded.

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 ‘Antlr3.Runtime’ Could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging,set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off,remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[BadImageFormatException: Could not load file or assembly
‘Antlr3.Runtime’ or one of its dependencies. This assembly is built by
a runtime newer than the currently loaded runtime and cannot be
loaded.] System.Reflection.Assembly._nLoad(AssemblyName fileName,
String codeBase,Evidence assemblySecurity,Assembly locationHint,
StackCrawlMark& stackMark,Boolean throwOnFileNotFound,Boolean
forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity,StackCrawlMark& stackMark,Boolean
forIntrospection) +416
System.Reflection.Assembly.InternalLoad(String assemblyString,Boolean
forIntrospection) +166 System.Reflection.Assembly.Load(String
assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
assemblyName,Boolean starDirective) +190

[ConfigurationErrorsException: Could not load file or assembly
‘Antlr3.Runtime’ or one of its dependencies. This assembly is built by
a runtime newer than the currently loaded runtime and cannot be
loaded.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
assemblyName,Boolean starDirective) +11244040
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
+388 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo
ai) +232
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection
compConfig) +210
System.Web.Compilation.buildprovidersCompiler..ctor(VirtualPath
configPath,Boolean supportLocalization,String outputAssemblyName)
+76 System.Web.Compilation.Applicationbuildprovider.GetGlobalAsaxbuildresult(Boolean
isprecompiledApp) +283
System.Web.Compilation.BuildManager.CompileGlobalAsax() +50
System.Web.Compilation.BuildManager.EnsuretopLevelFilesCompiled() +676

[HttpException (0x80004005): Could not load file or assembly
‘Antlr3.Runtime’ or one of its dependencies. This assembly is built by
a runtime newer than the currently loaded runtime and cannot be
loaded.]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
+76 System.Web.Compilation.BuildManager.EnsuretopLevelFilesCompiled()
+1012 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
appManager,IApplicationHost appHost,IConfigMapPathFactory
configMapPathFactory,HostingEnvironmentParameters hostingParameters)
+1025

[HttpException (0x80004005): Could not load file or assembly
‘Antlr3.Runtime’ or one of its dependencies. This assembly is built by
a runtime newer than the currently loaded runtime and cannot be
loaded.] System.Web.HttpRuntime.FirstRequestinit(HttpContext
context) +11338038
System.Web.HttpRuntime.EnsureFirstRequestinit(HttpContext context) +88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr,HttpContext context) +4356276

解决方法

你需要在IIS中更改它的运行时版本.
右键单击虚拟目录
并单击高级设置
将其更改为正确的池设置.我可以说重新安装后你的游泳池设置不正确.

您可以找到该过程

In Application Pools-> Select your site ->Set Application Pool
Defaults -> Select your correct version

如果这不起作用,此时您可以做的首选是从系统中引用框架4卸载所有.Net安装.清理系统,然后重新安装所有内容.

但我发现你使用的是IIS 7.5.因此,您可以发现许多功能变化,需要谨慎处理.您可以尝试在尝试重新安装之前设置应用程序池和其他设置.

.net – 无法加载文件或程序集“AutoMapper”或其依赖项之一

.net – 无法加载文件或程序集“AutoMapper”或其依赖项之一

我部署时遇到这个问题,我真的不知道如何解决它.任何的想法?
Server Error in '/' Application.
Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

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 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

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 'AutoMapper' Could not be loaded.


=== Pre-bind state information ===
LOG: User = IIS APPPOOL\DefaultAppPool
LOG: displayName = AutoMapper
(Partial)
LOG: Appbase = file:///C:/inetpub/wwwroot/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\bin
Calling assembly : (UnkNown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\web.config
LOG: Using host configuration file:C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\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/v2.0.50727/Temporary ASP.NET Files/root/e22c2559/92c7e946/AutoMapper.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/e22c2559/92c7e946/AutoMapper/AutoMapper.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/bin/AutoMapper.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

Stack Trace: 


[BadImageFormatException: Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
 System.Reflection.Assembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,Assembly locationHint,StackCrawlMark& stackMark,Boolean throwOnFileNotFound,Boolean forIntrospection) +0
 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,Boolean forIntrospection) +416
  System.Reflection.Assembly.InternalLoad(String assemblyString,Boolean forIntrospection) +166
  System.Reflection.Assembly.Load(String assemblyString) +35
  System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective) +190

 [ConfigurationErrorsException: Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective) +11224200
     System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388
 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
 System.Web.Compilation.buildprovidersCompiler..ctor(VirtualPath configPath,Boolean supportLocalization,String outputAssemblyName) +76
 System.Web.Compilation.Applicationbuildprovider.GetGlobalAsaxbuildresult(Boolean isprecompiledApp) +283

System.Web.Compilation.BuildManager.CompileGlobalAsax()50
System.Web.Compilation.BuildManager.EnsuretopLevelFilesCompiled()676

[HttpException (0x80004005): Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
  System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
  System.Web.Compilation.BuildManager.EnsuretopLevelFilesCompiled() +1012
  System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters) +1025

 [HttpException (0x80004005): Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.]
  System.Web.HttpRuntime.FirstRequestinit(HttpContext context) +11318198
  System.Web.HttpRuntime.EnsureFirstRequestinit(HttpContext context) +88
  System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context) +4348404

版本信息:Microsoft .NET Framework版本:2.0.50727.5446; ASP.NET版本:2.0.50727.5420

应用程序池配置为.NET 2.0:

Version information: Microsoft .NET Framework Version:2.0.50727.5446;
ASP.NET Version:2.0.50727.5420

部署的AutoMapper程序集是为.NET 4.0构建的:

“This assembly is built by a runtime newer than the currently loaded
runtime and cannot be loaded.”

这不会一起工作.您可以通过将应用程序池切换到.NET 4.0来解决此问题.

asp.net – 无法加载文件或程序集“log4net”或其依赖项之一

asp.net – 无法加载文件或程序集“log4net”或其依赖项之一

我正在尝试创建一个水晶报告,我是该领域的新手.我从 this tutorial post创建了一个水晶报告,但它似乎不起作用.

我的错误是:

Could not load file or assembly ‘log4net’ 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 ‘log4net’ 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 ‘log4net’ Could not be loaded.

解决方法

BadFormatimageException是您为32位体系结构编译程序时收到的错误,并将尝试加载64位库或反之亦然.从错误中,您可以参考log4net(一个众所周知的日志库). 首先,检查您正在创建应用程序的cpu类型(x86,x64,Anycpu) 其次,检查log4net的位数(你应该引用你的应用程序的相同位数) 第三,检查运行的操作系统IIS. (如果是x64和您的应用程序32,请在应用程序池的高级设置部分中将“启用32位应用程序”设置为true)

关于无法加载文件或程序集“ Newtonsoft.Json”或其依赖项之一。清单定义与程序集引用不匹配的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一、.net – 无法加载文件或程序集“Antlr3.Runtime”或其依赖项之一、.net – 无法加载文件或程序集“AutoMapper”或其依赖项之一、asp.net – 无法加载文件或程序集“log4net”或其依赖项之一等相关内容,可以在本站寻找。

本文标签: