gpt4 book ai didi

asp.net-mvc - VS 2015 : Could not load file or assembly 'System. Web.WebPages.Razor,版本=2.0.0.0

转载 作者:行者123 更新时间:2023-12-01 20:17:30 28 4
gpt4 key购买 nike

我正在运行一个包含不同项目的解决方案。但是,我正在尝试使用 Visual Studio 2015 和框架 4.6(在 Windows 8 操作系统、IIS Express 上)运行一个包含 wcf 服务的项目(类库)。但是它一直在浏览器中显示此错误:

错误:

enter imag*e description here

我注意到Razor 2.0的调用程序集是“System.Web.Mvc”版本4.0.0.1:

Calling assembly : System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

但是本项目中没有引用System.Web.MVC dll,项目中的引用如下图:

enter image description here

尽管它没有被引用,但它总是出现在 bin 文件夹中,即使我清除它也是如此。这可能就是它尝试调用“System.Web.WebPages.Razor”版本 2.0 的原因。

澄清问题的任何线索:

  1. 我在 Web.Config 中没有调用 System.web.mvc 的相关程序集

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>

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

  • 也不包含在包配置中:
  • <packages>
    <package id="EntityFramework" version="6.1.3" targetFramework="net46" />
    <package id="Microsoft.AspNet.Providers" version="2.0.0" targetFramework="net451" />
    <package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net451" />
    <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
    <package id="PostSharp" version="4.3.5-alpha" targetFramework="net46" />
    <package id="System.Web.Providers" version="1.2" targetFramework="net451" />
    </packages>

  • 不作为引用
  • 我想知道发生了什么事?可能另一个项目会影响它!我也尝试使用nugget来更新软件包(卸载并重新安装),但仍然处于相同的情况。

    问题的可能原因:

    我还注意到此项目中有一个“Gobal.asax”文件,它使用实现“System.Web.HttpApplication<”的“MvcApplication”类/strong>”这可能是问题的一个很好的原因。

    感谢任何帮助。

    最佳答案

    解决方案:通过 nuget 管理器安装 Microsoft.AspNet.Webpages 2.0 版本的第一个版本。

    关于asp.net-mvc - VS 2015 : Could not load file or assembly 'System. Web.WebPages.Razor,版本=2.0.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36320149/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com