问题描述
我在网站(Web应用程序)中使用了Umbraco 4.11.6.我的网站在localhost中运行(已通过Visual Studio 2012和IIS(v7)测试),但是当我从互联网空间运行它时出现错误.错误是:
I used Umbraco 4.11.6 in my website(web application).My website is worked in localhost(tested from Visual studio 2012 and IIS(v7)) but when I run it from internet space I got an error.The error was:
WRN:程序集绑定日志记录已关闭. 若要启用程序集绑定失败日志记录,请将注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog](DWORD)设置为1. 注意:与程序集绑定失败日志记录有一些性能上的损失. 要关闭此功能,请删除注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog].
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].
堆栈跟踪:
[FileLoadException:无法加载文件或程序集'System.Web.Razor, 版本= 2.0.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35'或 它的依赖项之一.找到的程序集的清单定义 与程序集引用不匹配. (来自HRESULT的异常: 0x80131040)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,字符串codeBase,证据程序集安全性,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder, 布尔值throwOnFileNotFound,布尔值用于自省,布尔值 hibitSecurityChecks)+0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly, StackCrawlMark& stackMark,IntPtr pPrivHostBinder,布尔 throwOnFileNotFound,用于自省的布尔值,布尔值 抑制安全性检查)+210
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, 证据集安全性,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,用于自省的布尔值)+242
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, 证据集安全性,StackCrawlMark& stackMark,布尔值 forIntrospection)+17 System.Reflection.Assembly.Load(字符串 assemblyString)+35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 assemblyName,布尔型starDirective)+122
[FileLoadException: Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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) +210
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17 System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122
[ConfigurationErrorsException:无法加载文件或程序集 'System.Web.Razor,版本= 2.0.0.0,文化=中性, PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.这 定位的程序集的清单定义与程序集不匹配 参考. (来自HRESULT的异常:0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 assemblyName,布尔型starDirective)+12761078
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()+142 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+334
System.Web.Compilation.BuildManager.CallPreStartInitMethods(字符串 preStartInitListPath)+203
System.Web.Compilation.BuildManager.ExecutePreAppStart()+152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost,appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParametershostingParameters, PolicyLevel policyLevel,异常appDomainCreationException)+1151
[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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) +12761078
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203
System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
[HttpException(0x80004005):无法加载文件或程序集 'System.Web.Razor,版本= 2.0.0.0,文化=中性, PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.这 定位的程序集的清单定义与程序集不匹配 参考. (来自HRESULT的异常:0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+12881540 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+12722601
[HttpException (0x80004005): Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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) +12881540 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722601
版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.17929
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
WebConfig的一部分:
a part of WebConfig:
<runtime>
<!-- Old asp.net ajax assembly bindings -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
推荐答案
解决此问题的方法很多:
Quite a few ways to fix this:
-
在Web服务器上安装MVC(并非总是可能的.).
Install MVC on the web server (which is not always possible).
在Visual Studio中,您可以将dll设置为在构建时复制到本地,请参阅以下文章(请注意,MVC dll的名称已稍有更改,但这为您提供了过程) http://haacked.com/archive/2008/11/03/bin-deploy- aspnetmvc.aspx
In visual studio you can set dlls to copy to local on build, see the following article (please note MVC dlls have changed names slightly but it gives you the process)http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx
将GAC中的相应dll复制到umbraco站点的bin文件夹中.为此,请在资源管理器中打开%windir%\ Microsoft.NET \ assembly \ GAC_MSIL",您会发现GAC中安装了所有dll,并且可以将适当的版本复制到您的项目中.这与上述方法类似,但绕过了构建项目的过程.
Copy the appropriate dlls from your GAC into the bin folder of the umbraco site.To do this open "%windir%\Microsoft.NET\assembly\GAC_MSIL" in explorer and you will find all of the dlls installed in the GAC and you can copy the appropriate versions into your project. This is similar to the above method but bypasses building the project.
就文件而言,您可能不仅需要System.Web.Razor.dll,还可以处理所有丢失的文件.
In terms of files you will likely need more than just System.Web.Razor.dll however this will work for all of the missing files.
这篇关于无法加载文件或程序集"System.Web.Razor"或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!