DotNetOpenAuth导致无法加载大会System.Web.WebPages.Razor [英] DotNetOpenAuth causing a can not load Assembly System.Web.WebPages.Razor

查看:446
本文介绍了DotNetOpenAuth导致无法加载大会System.Web.WebPages.Razor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的code我的本地版本运行得很好。但是,当我做了网络部署我收到以下异常:

My local version of my code runs just fine. But when I do a web deploy I am getting the following exception:

无法加载文件或程序集System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35或它的某一个依赖。找到的程序集清单定义不匹配的程序集引用。 (从HRESULT异常:0x80131040)

Could not load file or assembly 'System.Web.WebPages.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)

有关堆栈跟踪行

[FileLoadException:未能加载文件或程序集System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35或它的某一个依赖。找到的程序集清单定义不匹配的程序集引用。 (从HRESULT异常:0x80131040)]      Microsoft.Web.WebPages.OAuth。preApplicationStart code.Start()+ 0

[FileLoadException: Could not load file or assembly 'System.Web.WebPages.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)] Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +0

这似乎是相关的事实的NuGet包的剃刀是3.0版,但DotNetOpenAuth包使用2.0版

This seems to be related to the fact that the Nuget Package for Razor is version 3.0 but the DotNetOpenAuth package uses version 2.0

此外,当我部署到我的Azure网站的问题只发生。 (我目前使用的是免费的网站,而不是webrole / workrole的东西我)。我用一个webdeploy并且它正在确定在previous版本,但我相信这已经是与的NuGet包。

Also the issue only happens when I deploy to my Azure website. (I am currently using the free website and not the webrole/workrole stuff). I use a webdeploy and it was working ok in previous versions but I believe this has something to do with nuget packages.

更新: 我无法解决这个问题。我试图通过该删除整个文件夹在部署之前但这并没有工作,要么FTP部署。的NuGet一直是一个噩梦。

Update: I am unable to solve this. I have tried to deploy via FTP that deleted the whole folder prior to deployment but this did not work either. Nuget has been a nightmare.

推荐答案

把这个在你的web.config文件。它会导致框架重定向依赖于适当的版本。

Place this in your web.config file. It will cause the framework to redirect dependencies to the appropriate version.

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <configuration>

从未来修改​​

当我重新审视,因为指出上述语法的XML错误这个帖子,还有其他一些地方,最有可能需要更新。首先,在主web.config中,这条线应该在改变&LT;的appSettings&GT; 部分以下

As I revisit this post because of a XML error pointed out in the above syntax, there are a few other places that most likely need updated as well. First, in the primary web.config, this line should be changed in the <appSettings> section to the following

<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />

此外,还有在应更新到意见文件夹中的web.config以下

Also, there is a web.config in the views folder that should be updated to the following

 <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

基本上,你要确定所有提到剃刀2.0.0.0和改变那些3.0.0.0除了装配重定向的地方。我相信我有所有上述确定的地点。

Basically, you want to identify all of the places that mention razor 2.0.0.0 and change those to 3.0.0.0 in addition to the assembly redirect. I believe I have all of those locations identified above.

如果您更新整个MVC框架,有将需要以及执行的额外的工作,但这不是的基础的问题。

If you update the entire MVC framework, there is additional work that would need to be performed as well, but that is not the basis for the question.

这篇关于DotNetOpenAuth导致无法加载大会System.Web.WebPages.Razor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆