Asp.net mvc 上下文不存在每个视图页上都有错误

Asp.net mvc 上下文不存在每个视图页上都有错误,asp.net-mvc,view,web-config,Asp.net Mvc,View,Web Config,这是我的视图文件夹中的web.config文件------- 这是我的原始web.config文件-------------- 我已经添加了web.config文件。 现在,我面临的问题是,在我的项目中,每个视图页面上都有一条红线。它不识别模型、viewbag、actionlink、表单方法、文本框、编辑器。存在一个常量,当前上下文中不存在相同的消息xx。 有什么问题我不知道。我没有更新任何内容,也没有添加任何新内容。有什么问题请帮助我。您可能有冲突版本的System.Web.Mvc。我

这是我的视图文件夹中的web.config文件-------


这是我的原始web.config文件--------------


我已经添加了web.config文件。 现在,我面临的问题是,在我的项目中,每个视图页面上都有一条红线。它不识别模型、viewbag、actionlink、表单方法、文本框、编辑器。存在一个常量,当前上下文中不存在相同的消息xx。
有什么问题我不知道。我没有更新任何内容,也没有添加任何新内容。有什么问题请帮助我。

您可能有冲突版本的
System.Web.Mvc
。我会尝试在网站Web.config中为System.Web.Mvc添加dependentAssembly元素

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>


如果是5.2.3.0,请确保在项目引用中输入了所引用的版本号。。然后关闭在visual studio中打开的所有视图窗口,然后重新打开它们

您的引用中有哪个版本的System.Web.Mvc?我想问题出在视图文件夹的Web.config文件中。我错过了一些我不知道是什么。在我的项目参考文件夹中,我检查了system.web.mvc,它指向正确的5.2.3.0版本
     <configuration>
     <configSections>
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
     <!-- For more information on Entity Framework configuration, visit   http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
     <connectionStrings>
     <add name="DefaultConnection" connectionString="Data Source=ASHISH-PC\SQLEXPRESS;Initial Catalog=IdentityDatabase;Integrated Security=True" providerName="System.Data.SqlClient" />
    </connectionStrings>
    <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="owin:AppStartup" value="IdentitySample.Startup,Identity" /></appSettings>
    <system.web>
   <authentication mode="None" />
   <compilation debug="true" targetFramework="4.5" />
   <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
  <modules>
  <remove name="FormsAuthenticationModule" />
 </modules>
 </system.webServer>
 <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.AspNet.Identity.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
  </dependentAssembly>
  <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>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>