System.Web.WebPages.Html.HtmlHelper不包含定义

时间:2016-12-07 23:05:27

标签: c# asp.net-mvc razor

我知道有很多问题都在提出同样的问题,但我已经尝试了大部分问题而且找不到我搞砸的地方。我有一个包含多个项目的解决方案。因为它们是在不同的.net版本,我最终升级到.Net 4.5,从MVC 4升级到MVC 5.我当前的问题是在视图文件中,它不会识别任何剃刀语法(请原谅我,如果这是错误的术语),如@ model,ViewBag,ActionLink,DisplayNameFor等

我确保我的软件包是最新的,webconfig文件指向正确(我认为)。例如,它是否需要指向最后的十进制版本或仅指向顶部的十进制版本 <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />,无论我是否都试过。

我也删除了bin,obj,清除了我的温度,清理并重建了。你能看到我错过的东西吗?

的web.config

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <connectionStrings>
    <add name="TintagliaContext" connectionString="Data Source=SLD-GZQTHS1\SQLEXPRESS;Initial Catalog=coverpools;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
   <!--<add name="TintagliaContext" connectionString="Data Source=SLD-GZQTHS1\SQLEXPRESS;Initial Catalog=coverpools-NEW;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
  </connectionStrings>
  <appSettings>
    <!--<add key="webpages:Version" value="2.0.0.0" />-->
    <add key="webpages:Version" value="3.0.0.0" />

    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="CoverpoolsUrlNewQuote" value="http%3A%2F%2Fcoverpools.cloudapp.net%2Fecon2012%2FeConEngineHtml.aspx%3Fenvironment%3Ddefault%26model%3D%3Cmodel%3E%26modelversion%3D%3Cmodelversion%3E%26context%3D%3Ccontextid%3E%26language%3Ddefault%26formatlanguage%3Ddefault%26configtype%3Dconfiguration%26type%3D1%26saveas%3D%3Cconfigid%3E%26objectid%3D%3Cconfigid%3E%26user%3D%3Cdealerid%3E%26mobile%3Dtrue" />
    <add key="CoverpoolsUrlEditQuote" value="http%3A%2F%2Fcoverpools.cloudapp.net%2Fecon2012%2FeConEngineHtml.aspx%3Fenvironment%3Ddefault%26model%3D%3Cmodel%3E%26modelversion%3D%3Cmodelversion%3E%26context%3D%3Ccontextid%3E%26language%3Ddefault%26formatlanguage%3Ddefault%26configtype%3Dconfiguration%26type%3D1%26configuration%3D%3Cconfigid%3E%26saveas%3D%3Cconfigid%3E%26objectid%3D%3Cconfigid%3E%26user%3D%3Cdealerid%3E%26mobile%3Dtrue" />
    <add key="CoverpoolsUrlTracking" value="%3Ctrackingid%3E" />
    <add key="CoverpoolsUrlPrint" value="http%3A%2F%2Fcoverpools.cloudapp.net%2Fecon2012%2FeConPrintReport.aspx%3Fkey%3D%3Ckey%3E%26report%3D%3Creport%3E%26file%3D.pdf%26content%3Dapplication%2Fpdf" />
    <add key="CoverpoolsUrlConnectEcon" value="http%3A%2F%2Fcoverpools.cloudapp.net%2Fecon2012%2FeConBackendProcessing.aspx%3Fenvironment%3Ddefault%26model%3D%3Cmodel%3E%26modelversion%3D%3Cmodelversion%3E%26action%3Dconnect%26configuration%3D%3Cconfigid%3E%26keyonly%3Dtrue" />
  </appSettings>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5.2" />
      </system.Web>
  -->
  <system.web>
    <!--Added SimpleMemberShip based on http://stackoverflow.com/questions/15753864/to-call-this-method-the-membership-provider-property-must-be-an-instance-of-->
        <roleManager enabled="true" defaultProvider="SimpleRoleProvider">
        <providers>
            <clear />
            <add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
        </providers>
    </roleManager>
    <membership defaultProvider="SimpleMembershipProvider">
        <providers>
            <clear />
            <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
        </providers>
    </membership>
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
        <providers>
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
        </providers>
    </sessionState>
    <!--END ADDEDSimpleMemberShip-->

    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime />
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" name=".ASPXFORMSAUTH" protection="All" />
    </authentication>
    <pages controlRenderingCompatibilityVersion="4.0">
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

    <!-- added per https://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2-->
    <modules>
      <remove name="RoleManager" />
    </modules>
    <!-- /added -->

  <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.2.3.0" newVersion="3.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.2.3.0" newVersion="3.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.2.3.0" newVersion="3.2.3.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>
      <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>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <log4net>
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
      <file value="App_Data\Logs.txt" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <maximumFileSize value="5MB" />
      <maxSizeRollBackups value="2" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="INFO" />
      <appender-ref ref="RollingFile" />
    </root>
  </log4net>
</configuration>

视图/ web.config中

<?xml version="1.0"?>

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

  <system.web.webPages.razor>
    <!--<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />-->
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>

  <system.web>
    <httpHandlers>
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
    </httpHandlers>

    <!--
        Enabling request validation in view pages would cause validation to occur
        after the input has already been processed by the controller. By default
        MVC performs request validation before a controller processes the input.
        To change this behavior apply the ValidateInputAttribute to a
        controller or action.
    -->
    <!--<pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">-->
    <pages
    validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <!--<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />-->
        <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />

      </controls>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>

CodeFirst项目 app.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="TintagliaContext" connectionString="Data Source=SLD-GZQTHS1\SQLEXPRESS;Initial Catalog=coverpools;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <!--<add name="TintagliaContext" connectionString="Data Source=SLD-GZQTHS1\SQLEXPRESS;Initial Catalog=coverpools-NEW;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.2.3.0" newVersion="3.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebHelpers" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebPages.Data" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebPages.WebData" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
  <package id="PagedList" version="1.17.0.0" targetFramework="net45" />
  <package id="PagedList.Mvc" version="4.5.0.0" targetFramework="net45" />
</packages>

这是我编译时得到的内容: Could not load file or assembly 'System.Web.Helpers' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

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. 


=== Pre-bind state information ===
LOG: DisplayName = System.Web.Helpers
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Web.Helpers | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///F:/sites/OnlineOrder/Coverpools Dealer Portal/Infotech Coverpools Portal Tintaglia/Source/Infotech.Coverpools.Portal.Tintaglia.Web/
LOG: Initial PrivatePath = F:\sites\OnlineOrder\Coverpools Dealer Portal\Infotech Coverpools Portal Tintaglia\Source\Infotech.Coverpools.Portal.Tintaglia.Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: F:\sites\OnlineOrder\Coverpools Dealer Portal\Infotech Coverpools Portal Tintaglia\Source\Infotech.Coverpools.Portal.Tintaglia.Web\web.config
LOG: Using host configuration file: C:\Users\joshua.mcgee\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:/Users/joshua.mcgee/AppData/Local/Temp/Temporary ASP.NET Files/root/0af143ab/206c340/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///C:/Users/joshua.mcgee/AppData/Local/Temp/Temporary ASP.NET Files/root/0af143ab/206c340/System.Web.Helpers/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///F:/sites/OnlineOrder/Coverpools Dealer Portal/Infotech Coverpools Portal Tintaglia/Source/Infotech.Coverpools.Portal.Tintaglia.Web/bin/System.Web.Helpers.DLL.
LOG: Using application configuration file: F:\sites\OnlineOrder\Coverpools Dealer Portal\Infotech Coverpools Portal Tintaglia\Source\Infotech.Coverpools.Portal.Tintaglia.Web\web.config
LOG: Using host configuration file: C:\Users\joshua.mcgee\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 3.0.0.0 redirected to 3.2.3.0.
LOG: Post-policy reference: System.Web.Helpers, Version=3.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/joshua.mcgee/AppData/Local/Temp/Temporary ASP.NET Files/root/0af143ab/206c340/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///C:/Users/joshua.mcgee/AppData/Local/Temp/Temporary ASP.NET Files/root/0af143ab/206c340/System.Web.Helpers/System.Web.Helpers.DLL.
LOG: Attempting download of new URL file:///F:/sites/OnlineOrder/Coverpools Dealer Portal/Infotech Coverpools Portal Tintaglia/Source/Infotech.Coverpools.Portal.Tintaglia.Web/bin/System.Web.Helpers.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.


Stack Trace:


[FileLoadException: Could not load file or assembly 'System.Web.Helpers' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]

[FileLoadException: Could not load file or assembly 'System.Web.Helpers, Version=3.2.3.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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Helpers, Version=3.2.3.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) +738
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Helpers, Version=3.2.3.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) +9946132
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

1 个答案:

答案 0 :(得分:0)

您的错误会告诉您问题所在。无论你的引用中的System.Web.Helpers有什么DLL版本都不匹配某个项目文件。您可以右键单击每个项目并卸载项目,然后再次右键单击不可用项目并选择“编辑项目”。查找System.Web.Helpers并确保每个项目的版本号一致,