2016-11-18 147 views
2

我将我的项目迁移到ASP.NET Core 1.1.0和Entity Framework Core 1.1,所有的开发工作都很好。部署ASP.NET Core 1.1.0和实体框架Core 1.1:无法加载程序集system.Collections.Immutable,Version = 1.1.37.0

但无法部署在分期项目,我从stdout中记录此错误:

应用程序启动异常:System.IO.FileLoadException:不可能 德充电器乐fichier OU L'装配 “微软.Extensions.DependencyInjection.Abstractions, Version = 1.0.0.0,Culture = neutral,PublicKeyToken = adb9793829ddae60'或 une de ses d,pendances。 La d,finition trouv,e du manifeste de l'assembly ne对应于大会的议会。 (异常 德HRESULT:0x80131040)喃德fichierÿ: 'Microsoft.Extensions.DependencyInjection.Abstractions, 版本= 1.0.0.0,文化=中性公钥= adb9793829ddae60'
... Agata.Presentation.Web.Startup.ConfigureServices( IServiceCollection services) --- Fin de la trace de la pile ... partir de l'eplacement pr,cdentdent au niveau duquel l'exception a,t,lev,e --- ... System.Runtime.ExceptionServices。 ExceptionDispatchInfo.Throw()... Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)... Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() ... Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

我检查了所有的Nu​​Get包从包含在溶液中的所有项目和所有的依赖是最新的。

我已经删除了所有的分段目录并完全重新部署它,以确保没有旧的dll,但错误仍在此处。 我也重新启动了IIS池和网站几次。

而.NET Core 1.1.0安装在服务器上。

任何人对这里发生了什么都有想法?

编辑:这是我的project.json:

"dependencies": { 
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.2", 
    "Microsoft.AspNetCore.Diagnostics": "1.1.0", 
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview3-final", 
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview3-final", 
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview3-final", 
    "Npgsql": "3.1.6", 
    "Remotion.Linq": "2.1.1", 
    "Serilog.Sinks.RollingFile": "3.2.0", 
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", 
    "Microsoft.AspNetCore.StaticFiles": "1.1.0", 
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", 
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0", 
    "Microsoft.Extensions.Configuration.Binder": "1.1.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0", 
    "Microsoft.Extensions.Configuration.Json": "1.1.0", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0", 
    "Microsoft.Extensions.Logging.Console": "1.1.0", 
    "Microsoft.Extensions.Logging.Debug": "1.1.0", 
    "Serilog.Extensions.Logging": "1.3.0", 
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0", 
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0", 
    "Microsoft.AspNetCore.Mvc": "1.1.0", 
    "Microsoft.Extensions.Logging": "1.1.0", 
    "Microsoft.EntityFrameworkCore": "1.1.0", 
    "System.Interactive.Async": "3.1.0", 
    "Microsoft.Extensions.DependencyInjection.Abstractions": "1.1.0", 
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final" 
    }, 

    "tools": { 
    "Microsoft.Extensions.SecretManager.Tools": "1.1.0-preview4-final", 
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final" 
    }, 

编辑:问题是现在不同了,错误是现在:

应用程序启动异常:System.IO.FileLoadException : Impossible de charger le fichier ou l'assembly 'System.Interactive.Async,Version = 3.0.0.0,Culture = neutral, PublicKeyToken = 94bc3704cddfc263'ou une de ses d,pendances。 La d,finition trouv,e du manifeste de l'assembly ne corresponding pas ... la référencede l'assembly。 (例外德HRESULT:0x80131040) 喃德fichierÿ: 'System.Interactive.Async,版本= 3.0.0.0,文化=中性公钥= 94bc3704cddfc263' ... Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddQuery(IServiceCollection serviceCollection) ... Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions。AddEntityFramework(IServiceCollection serviceCollection) ... Microsoft.EntityFrameworkCore.Infrastructure.RelationalServiceCollectionExtensions.AddRelational(IServiceCollection 服务) ... Microsoft.Extensions.DependencyInjection.SqlServerServiceCollectionExtensions.AddEntityFrameworkSqlServer(IServiceCollection 服务) ... Agata.Presentation.Web.Startup.ConfigureServices( IServiceCollection services)dans C:\ Workspace \ PerformancesEtControles \ Agata \ DevLot1 \ Presentation \ Agata.Presentation.Web \ Startup.cs:ligne --- Fin de la trace de la pile ... partir de l'eplacement pr ,cndent au niveau duquel l'exception a,t,lev,e --- ... System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ... Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection 服务) ... Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() ... Microsoft.AspNetCore。 Hosting.Internal.WebHost.BuildApplication()

这是我更新project.json:

"dependencies": { 
    "Npgsql": "3.1.6", 
    "Remotion.Linq": "2.1.1", 
    "Serilog.Sinks.RollingFile": "3.2.0", 
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", 
    "Microsoft.AspNetCore.StaticFiles": "1.1.0", 
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", 
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0", 
    "Microsoft.Extensions.Configuration.Binder": "1.1.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0", 
    "Microsoft.Extensions.Configuration.Json": "1.1.0", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0", 
    "Microsoft.Extensions.Logging.Console": "1.1.0", 
    "Microsoft.Extensions.Logging.Debug": "1.1.0", 
    "Serilog.Extensions.Logging": "1.3.0", 
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0", 
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0", 
    "Microsoft.AspNetCore.Mvc": "1.1.0", 
    "Microsoft.Extensions.Logging": "1.1.0", 
    "Microsoft.EntityFrameworkCore": "1.1.0", 
    "Microsoft.Extensions.DependencyInjection.Abstractions": "1.1.0", 
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final", 
    "System.Interactive.Async": "3.1.0" 
    }, 

    "tools": { 
    "Microsoft.Extensions.SecretManager.Tools": "1.1.0-preview4-final", 
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final" 
    }, 

我的启动文件的第65行是:

services.AddEntityFrameworkSqlServer().AddDbContext<MyDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MyDbConnectionString"))); 

它仍然在工作与Visual Studio调试细...

编辑2:我解决了System.Interactive.Async更新Serilog.Extensions.Logging包......我现在已经错误:

System.IO.FileLoadException:不可能去充电器乐fichier欧 L'集“System.Collections.Immutable,版本= 1.1.37.0, 文化= NEUT ralph lauren,PublicKeyToken = b03f5f7f11d50a3a'ou une de ses 。 Ladéfinitiontrouvéedu manifeste de l'assembly ne 对应于大会礼堂。 (例外德HRESULT: 0x80131040)喃德fichier: 'System.Collections.Immutable, 版本= 1.1.37.0文化=中性公钥= b03f5f7f11d50a3a'
à Microsoft.AspNetCore.Mvc.Razor.Internal.RazorReferenceManager。 .ctor(ApplicationPartManager partManager,IOptions`1 optionsAccessor) ---翅德拉痕量德拉一堆partir DE L'进驻先例AU niveau duquel L'异常的ETE大堤---

我我只是疯狂的这个部署...

解决方案:部署Web应用程序可执行文件的配置文件,其中包含一些类库依赖项绑定

+0

,如果有人可以创建标签“asp.net核-1.1”并标记我的问题,我没有足够的声誉来做到这一点。谢谢 – AdrienTorris

+0

显示你的Project.json –

+0

你必须使用Microsoft.Extensions.DependencyInjection.Abstractions v 1.0.0其他软件包有依赖关系。尝试改变它。 –

回答

3

解决方案是部署包含某些类库依赖项绑定的Web应用程序可执行文件的配置文件。 .NET的一个旧练习是永远不会部署.config文件,但这种做法显然需要使用.NET Core进行审核。

当您发布您的网站时,生成的软件包包含一些配置文件,其中一个与您的应用程序的可执行文件YourWebsiteNamespace.exe.config具有相同的名称。此配置文件包含一些DLL绑定和需要与你的应用程序

的这是什么文件可以包含实例进行部署:

<configuration> 
    <runtime> 
    <gcServer enabled="true" /> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
     <bindingRedirect oldVersion="4.0.0.0" newVersion="4.1.1.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
     <bindingRedirect oldVersion="1.1.37.0" newVersion="1.2.1.0" /> 
     <bindingRedirect oldVersion="1.2.0.0" newVersion="1.2.1.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
     <bindingRedirect oldVersion="1.2.0.0" newVersion="1.4.1.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
     <bindingRedirect oldVersion="4.0.0.0" newVersion="4.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> 
     <bindingRedirect oldVersion="4.0.0.0" newVersion="4.1.2.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> 
     <bindingRedirect oldVersion="4.0.0.0" newVersion="4.0.1.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
</configuration> 
+0

我@Adrien,你能更具体吗?我也有同样的问题。 – Beetlejuice

+0

@Beetlejuice增加了一些信息。你可以取消你的退票吗? – AdrienTorris

+0

你从哪里得到这些特定的dll版本? – Beetlejuice

相关问题