部署到Azure会导致致命错误

问题描述 投票:3回答:2

我正在尝试将我的演示IdentityServer4应用程序发布到Azure Web应用程序服务以进行测试。一切都很好,包括应用程序负载。

但是,没有生成日志,所以我怀疑并检查诊断并发现:

2018-02-28 08:54:21.626 +00:00 [Critical] Microsoft.AspNetCore.Hosting.Internal.WebHost: Hosting startup assembly exception
System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.AzureKeyVault.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureKeyVault.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)

不仅没有生成日志,我的一些操作也不能正常工作。在这种情况下登录identityserver4的能力(我建立了一个自定义存储)。

谁能破译我在这里做错了什么?不知道从哪里开始寻找。

identityserver4 azure-web-app-service
2个回答
3
投票

看起来你错过了Microsoft.AspNetCore.AzureKeyVault.HostingStartup组装。

你能检查一下它是你的部署包的一部分吗?


2
投票

该问题似乎与Azure Web App Service的运行方式有关。出于某种原因,它正在调用此程序集以获取未知功能。

不幸的是,Asp Net Core 2.0没有将这个程序集作为任何软件包的一部分,从它的外观来看,它并不存在于任何2.1之前的库中。

解决方案是对包进行脏安装:

dotnet add package Microsoft.AspNetCore.AzureKeyVault.HostingStartup --version 2.1.0-preview1-27946 --source https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json

这基本上部署了与ASP CORE 2.0不兼容的软件包,但是当发布到Azure时,就一劳永逸地消除了这个问题。

在这方面,该软件包将成为即将推出的Microsoft.AspNetCore.All 2.1的一部分。

© www.soinside.com 2019 - 2024. All rights reserved.