GVKun编程网logo

asp.net-mvc – 无法加载文件或程序集System.Web.WebPages.Razor,版本= 3.0.0.0或其依赖项之一

11

本文将为您提供关于asp.net-mvc–无法加载文件或程序集System.Web.WebPages.Razor,版本=3.0.0.0或其依赖项之一的详细介绍,同时,我们还将为您提供关于.net–无法

本文将为您提供关于asp.net-mvc – 无法加载文件或程序集System.Web.WebPages.Razor,版本= 3.0.0.0或其依赖项之一的详细介绍,同时,我们还将为您提供关于.net – 无法加载文件或程序集“Antlr3.Runtime”或其依赖项之一、.net – 无法加载文件或程序集“AutoMapper”或其依赖项之一、asp.net – 无法加载文件或程序集System.Web.Http,版本= 5.2.2.0、asp.net – 无法加载文件或程序集“log4net”或其依赖项之一的实用信息。

本文目录一览:

asp.net-mvc – 无法加载文件或程序集System.Web.WebPages.Razor,版本= 3.0.0.0或其依赖项之一

asp.net-mvc – 无法加载文件或程序集System.Web.WebPages.Razor,版本= 3.0.0.0或其依赖项之一

我在我的应用程序中使用MVC 5,WCF和Unity框架。

当我运行WCF服务时,我得到以下错误:

Server Error in '/' Application.

Could not load file or assembly 'System.Web.WebPages.Razor,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

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.IO.FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

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 'System.Web.WebPages.Razor,PublicKeyToken=31bf3856ad364e35' 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: 


[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.Mvc.PreApplicationStartCode.Start() +0

[InvalidOperationException: The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
   System.Web.Compilation.BuildManager.InvokePreStartinitMethodscore(ICollection`1 methods,Func`1 setHostingEnvironmentCultures) +556
   System.Web.Compilation.BuildManager.InvokePreStartinitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartinitMethods(String preStartinitListPath,Boolean& isRefAssemblyLoaded) +102
   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): The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor,PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
   System.Web.HttpRuntime.FirstRequestinit(HttpContext context) +9882460
   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.33440

我在WCF项目中添加了System.Web.WebPages.Razor,Version = 3.0.0.0,仍然存在相同的错误。

有人知道如何解决这个错误?

解决方法

确保您的项目定位为.net 4.5,所有引用都是有效的,并且Web AspNet.WebPages。*位于bin(Release / Debug)文件夹中。

您还可以尝试在包管理器控制台中使用此命令重新安装Microsoft.AspNet.WebPages nuget软件包

> Update-Package –reinstall Microsoft.AspNet.WebPages

.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 – 无法加载文件或程序集System.Web.Http,版本= 5.2.2.0

asp.net – 无法加载文件或程序集System.Web.Http,版本= 5.2.2.0

我刚刚将一个Asp.Net Web Api 2.2项目上传到生产服务器,并得到标题中的错误.在我的Web.config我已经有:
<dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
  </dependentAssembly>

文件确实存在于bin中.会造成什么?所有我的Asp.Net Web API文件都是最新的,并显示5.2.2的版本.它在我的开发机器上工作正常.

解决方法

在System.Web.Http和System.Web.Http.WebHost程序集的属性中将copy Local设置为true,并重新部署程序包.

如果这不能解决您的问题,请尝试重新安装NuGet软件包.这将有助于纠正破坏的依赖关系.从包管理控制台,运行以下命令:

Update-Package Microsoft.AspNet.WebApi -reinstall

确保安装System.Web.Http.WebHost以及.

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)

今天的关于asp.net-mvc – 无法加载文件或程序集System.Web.WebPages.Razor,版本= 3.0.0.0或其依赖项之一的分享已经结束,谢谢您的关注,如果想了解更多关于.net – 无法加载文件或程序集“Antlr3.Runtime”或其依赖项之一、.net – 无法加载文件或程序集“AutoMapper”或其依赖项之一、asp.net – 无法加载文件或程序集System.Web.Http,版本= 5.2.2.0、asp.net – 无法加载文件或程序集“log4net”或其依赖项之一的相关知识,请在本站进行查询。

本文标签: