2

我在工作中获得了一台更新的笔记本电脑,并检查了所有内容,然后将其下载到我的新机器上。然后几乎花了一整天的时间整理所有 Nuget 引用并重新安装软件包等...我现在遇到了错误主题行...

请注意,它正在寻找 System.Web.Cors 而不是 System.Web.Http.Cors.dll 确实存在......

下面是我的packages.config ..

 <packages>
    <package id="Antlr" version="3.4.1.9004" targetFramework="net452" />
    <package id="Autofac" version="4.0.0-rc1-177" targetFramework="net452" />
    <package id="Autofac.WebApi2" version="4.0.0-beta7-215" targetFramework="net452" />
    <package id="bootstrap" version="3.0.0" targetFramework="net452" />
    <package id="jQuery" version="1.10.2" targetFramework="net452" />
    <package id="Microsoft.AspNet.Cors" version="6.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.AspNet.Http.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.AspNet.Http.Extensions" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.AspNet.Http.Features" version="1.0.0-rc1-final" 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.Web.Optimization" version="1.1.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.Cors" version="5.2.3" targetFramework="net452" />
    <package id="Microsoft.AspNet.WebApi.HelpPage" version="5.2.3" targetFramework="net452" />
    <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
    <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
    <package id="Microsoft.Azure.DocumentDB" version="1.6.2" targetFramework="net452" />
    <package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net452" />
    <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
    <package id="Microsoft.Data.Edm" version="5.7.0" targetFramework="net452" />
    <package id="Microsoft.Data.OData" version="5.7.0" targetFramework="net452" />
    <package id="Microsoft.Data.Services.Client" version="5.7.0" targetFramework="net452" />
    <package id="Microsoft.Extensions.Configuration" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Extensions.Configuration.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Extensions.Configuration.Binder" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Extensions.OptionsModel" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Extensions.Primitives" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Extensions.WebEncoders.Core" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
    <package id="Microsoft.Net.Http.Headers" version="1.0.0-rc1-final" targetFramework="net452" />
    <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
    <package id="Microsoft.Web.WebJobs.Publish" version="1.0.11" targetFramework="net452" />
    <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.1" targetFramework="net452" />
    <package id="Modernizr" version="2.6.2" targetFramework="net452" />
    <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
    <package id="Respond" version="1.2.0" targetFramework="net452" />
    <package id="System.Net.Http" version="4.0.1-beta-23516" targetFramework="net452" />
    <package id="System.Net.Http.Formatting.Extension" version="5.2.3.0" targetFramework="net452" />
    <package id="System.Spatial" version="5.7.0" targetFramework="net452" />
    <package id="WebGrease" version="1.5.2" targetFramework="net452" />
    <package id="WindowsAzure.Storage" version="7.0.1-preview" targetFramework="net452" />
  </packages>

我的网络配置相关部分是......

</dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </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.Net.Http.Formatting" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>


      <dependentAssembly>
    <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>

    </assemblyBinding>

该项目构建良好,有一些警告,但是在调试中本地运行它时我得到了错误

    Could not load file or assembly 'System.Web.Cors, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Cors, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error: 


Line 42:             config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
Line 43:             AreaRegistration.RegisterAllAreas();
Line 44:             GlobalConfiguration.Configure(WebApiConfig.Register);
Line 45:             FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
Line 46:             RouteConfig.RegisterRoutes(RouteTable.Routes);
4

0 回答 0