![](/img/trans.png)
[英]Deploying .net core 3.1 web app to Azure Linux App Service
[英]Publishing .NET Core 3.1 web app to Azure App Service Linux using VS 2019 showing Welcome screen
我正在尝试使用 Visual Studio 2019 在 Azure App Service Linux 上部署我的 .NET Core 3.1 MVC Web 应用程序。部署后我能看到的只是下面显示的欢迎屏幕。
我检查了一些 SO 链接,这些链接要求我检查文件是否存在于http://{app-name}.scm.azurewebsites.net 上,我确认在那里。 检查下面的图像。
我还在我的应用服务配置页面上添加了正确的启动命令。
编辑进一步挖掘,我从 Azure 中发现了以下错误日志文件。
2020-03-11T20:19:14.263485764Z _____
2020-03-11T20:19:14.263521665Z / _ \ __________ _________ ____
2020-03-11T20:19:14.263527465Z / /_\ \___ / | \_ __ \_/ __ \
2020-03-11T20:19:14.263531865Z / | \/ /| | /| | \/\ ___/
2020-03-11T20:19:14.263535966Z \____|__ /_____ \____/ |__| \___ >
2020-03-11T20:19:14.263540366Z \/ \/ \/
2020-03-11T20:19:14.263544466Z A P P S E R V I C E O N L I N U X
2020-03-11T20:19:14.263548466Z
2020-03-11T20:19:14.263552066Z Documentation: http://aka.ms/webapp-linux
2020-03-11T20:19:14.263555866Z Dotnet quickstart: https://aka.ms/dotnet-qs
2020-03-11T20:19:14.263559566Z ASP .NETCore Version: 3.1.0
2020-03-11T20:19:14.263563267Z Note: Any data outside '/home' is not persisted
2020-03-11T20:19:14.438520438Z Running oryx -appPath /home/site/wwwroot -output /opt/startup/startup.sh -defaultAppFilePath /defaulthome/hostingstart/hostingstart.dll -bindPort 8080 -userStartupCommand ''
2020-03-11T20:19:14.654004939Z Oryx Version: 0.2.20191105.2, Commit: 67e159d71419415435cb5d10c05a0f0758ee8809, ReleaseTagName: 20191105.2
2020-03-11T20:19:14.661143991Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-03-11T20:19:14.661606007Z Could not find operation ID in manifest. Generating an operation id...
2020-03-11T20:19:14.662016422Z Build Operation ID: e539cda2-065a-4380-8443-113a8833110a
2020-03-11T20:19:16.245422274Z Writing output script to '/opt/startup/startup.sh'
2020-03-11T20:19:16.918107003Z Trying to find the startup DLL name...
2020-03-11T20:19:16.918873230Z Found the startup D name: BHD.Web.dll
2020-03-11T20:19:16.918885630Z Running the command: dotnet "BHD.Web.dll"
2020-03-11T20:19:21.158001162Z Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Razor.Runtime, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
2020-03-11T20:19:21.158026363Z
2020-03-11T20:19:21.158031663Z File name: 'Microsoft.AspNetCore.Razor.Runtime, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
2020-03-11T20:19:21.158036463Z at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
2020-03-11T20:19:21.158041063Z at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
2020-03-11T20:19:21.158045763Z at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
2020-03-11T20:19:21.158052864Z at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
2020-03-11T20:19:21.158063864Z at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
2020-03-11T20:19:21.158068564Z at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
2020-03-11T20:19:21.158072864Z at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
2020-03-11T20:19:21.158076964Z at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
2020-03-11T20:19:21.158081065Z at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)
2020-03-11T20:19:21.158085265Z at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](Assembly element)
2020-03-11T20:19:21.158089465Z at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartFactory.GetApplicationPartFactory(Assembly assembly)
2020-03-11T20:19:21.158094665Z at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateDefaultParts(String entryAssemblyName)
2020-03-11T20:19:21.158098965Z at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
2020-03-11T20:19:21.158103165Z at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
2020-03-11T20:19:21.158107265Z at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersCore(IServiceCollection services)
2020-03-11T20:19:21.158111866Z at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViewsCore(IServiceCollection services)
2020-03-11T20:19:21.158115966Z at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViews(IServiceCollection services)
2020-03-11T20:19:21.158120066Z at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
2020-03-11T20:19:21.158124266Z at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddRelatedParts(IdentityBuilder builder)
2020-03-11T20:19:21.158128466Z at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddDefaultUI(IdentityBuilder builder)
2020-03-11T20:19:21.158132666Z at BHD.Web.Startup.ConfigureServices(IServiceCollection services) in C:\Priyank\Projects\ServiceBerry\Sourcecode\BHD.Web\Startup.cs:line 36
2020-03-11T20:19:21.158137267Z at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
2020-03-11T20:19:21.158141367Z at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-03-11T20:19:21.158145567Z at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
2020-03-11T20:19:21.158152667Z at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
2020-03-11T20:19:21.158157267Z at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
2020-03-11T20:19:21.158161567Z at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
2020-03-11T20:19:21.158166368Z at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
2020-03-11T20:19:21.158170568Z at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
2020-03-11T20:19:21.158175068Z at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
2020-03-11T20:19:21.158179168Z at Microsoft.Extensions.Hosting.HostBuilder.Build()
2020-03-11T20:19:21.158183268Z at BHD.Web.Program.Main(String[] args) in C:\Priyank\Projects\ServiceBerry\Sourcecode\BHD.Web\Program.cs:line 16
2020-03-11T20:19:21.158187668Z
2020-03-11T20:19:21.177212339Z
2020-03-11T20:19:21.207111394Z ptrace(ATTACH, 29) FAILED Operation not permitted
2020-03-11T20:19:21.207772817Z Writing minidump with heap to file /home/logs/dumps/coredump.519bbab76c1d.29.1583957954
2020-03-11T20:19:21.618304499Z /opt/startup/startup.sh: line 12: 29 Aborted (core dumped) dotnet "BHD.Web.dll"
如果您没有位于hostingstart.html
上方的起始页,就会发生这种情况。 确保您的默认页面列在此处并且位于hostingstart.html
之上,以便默认情况下选择它。
您需要在常规设置下将启动命令设置为 dotnet yourapp.dll。
还要确保在 Visual Studio 上选中“重新发布期间在目标按钮上删除其他文件”。 这将在上传文件之前删除 WebApp 中的现有文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.