[英]Azure release pipeline publish to NetCore 3.1 linux app service fails with exit code 145 - 'Not possible to find any .NET Core SDKs' in log
I'm publishing a .net core 3.1 app that is saved in an Azure DevOps repo, built in a build pipeline and published to an Azure Linux Web App Service container. I'm publishing a .net core 3.1 app that is saved in an Azure DevOps repo, built in a build pipeline and published to an Azure Linux Web App Service container. The whole process seems to go well and the according to the deployment blade in the App Service the deployment was successful.整个过程似乎 go 很好,并且根据应用服务中的部署刀片部署成功。
Expected Result预期结果
I expect to see my deployed website when I go to the public URL.当我向公众 URL 公开 go 时,我希望看到我部署的网站。
Actual Result实际结果
Instead I see the new host page that says "Hey, .NET Core developers. Your app service is up and running. Time to take the next step and deploy your code".相反,我看到了新的主机页面,上面写着“嘿,.NET 核心开发人员。您的应用服务已启动并正在运行。是时候采取下一步行动并部署您的代码了”。
Additional Info附加信息
It appears that the app service is launching the default app because it's having a problem starting my published app.应用服务似乎正在启动默认应用,因为它在启动我已发布的应用时出现问题。
The startup command I've specified in the app service general configuration is:我在应用服务常规配置中指定的启动命令是:
dotnet "SmartSAR.dll"
Log for App Service startup应用服务启动日志
2020-04-18 07:39:27.802 INFO - Container smartsar_0_36ea601f for site smartsar initialized successfully and is ready to serve requests.
2020-04-18T07:39:25.664749049Z _____
2020-04-18T07:39:25.664775249Z / _ \ __________ _________ ____
2020-04-18T07:39:25.664780549Z / /_\ \___ / | \_ __ \_/ __ \
2020-04-18T07:39:25.664799849Z / | \/ /| | /| | \/\ ___/
2020-04-18T07:39:25.664803949Z \____|__ /_____ \____/ |__| \___ >
2020-04-18T07:39:25.664808049Z \/ \/ \/
2020-04-18T07:39:25.664811949Z A P P S E R V I C E O N L I N U X
2020-04-18T07:39:25.664815749Z
2020-04-18T07:39:25.664819349Z Documentation: http://aka.ms/webapp-linux
2020-04-18T07:39:25.664823149Z Dotnet quickstart: https://aka.ms/dotnet-qs
2020-04-18T07:39:25.664826849Z ASP .NETCore Version: 3.1.0
2020-04-18T07:39:25.664830549Z Note: Any data outside '/home' is not persisted
2020-04-18T07:39:25.727133075Z Running oryx -appPath /home/site/wwwroot -output /opt/startup/startup.sh -defaultAppFilePath /defaulthome/hostingstart/hostingstart.dll -bindPort 8080 -userStartupCommand 'dotnet "SmartSAR.dll"'
2020-04-18T07:39:25.730817476Z Oryx Version: 0.2.20200114.13, Commit: 204922f30f8e8d41f5241b8c218425ef89106d1d, ReleaseTagName: 20200114.13
2020-04-18T07:39:25.737275979Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-04-18T07:39:25.737697979Z Could not find operation ID in manifest. Generating an operation id...
2020-04-18T07:39:25.738149780Z Build Operation ID: 6b038e35-4bdc-4c95-ba56-af4ed38e0ce0
2020-04-18T07:39:26.610476848Z Writing output script to '/opt/startup/startup.sh'
2020-04-18T07:39:27.105207557Z Running user provided startup command...
2020-04-18T07:39:27.112012760Z It was not possible to find any installed .NET Core SDKs
2020-04-18T07:39:27.112467060Z Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
2020-04-18T07:39:27.112892061Z https://aka.ms/dotnet-download
2020-04-18T07:39:27.113473661Z WARNING: Startup command execution failed with exit code 145
2020-04-18T07:39:27.113786261Z Running the default application instead...
2020-04-18T07:39:27.447628502Z Hosting environment: Production
2020-04-18T07:39:27.448410002Z Content root path: /defaulthome/hostingstart/
2020-04-18T07:39:27.449102503Z Now listening on: http://[::]:8080
Build Pipeline YAML构建管道 YAML
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: UseDotNet@2
displayName: ".NET Core 3.1.x"
inputs:
version: '3.1.x'
packageType: sdk
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
The artifact generated is a drop containing a WebApp.zip deployment file (plus associated files).生成的工件是一个包含 WebApp.zip 部署文件(以及相关文件)的 drop。
From what I can tell, the dll being generated that I need to start is SmartSAR.dll.据我所知,我需要开始生成的 dll 是 SmartSAR.dll。 From the build log:从构建日志:
Building target "_CopyOutOfDateSourceItemsToOutputDirectory" partially, because some output files are out of date with respect to their input files.
Copying file from "d:\a\1\s\SmartSAR\obj\Release\netcoreapp3.1\SmartSAR.exe" to "d:\a\1\s\SmartSAR\bin\Release\netcoreapp3.1\SmartSAR.exe".
CopyFilesToOutputDirectory:
Copying file from "d:\a\1\s\SmartSAR\obj\Release\netcoreapp3.1\SmartSAR.dll" to "d:\a\1\s\SmartSAR\bin\Release\netcoreapp3.1\SmartSAR.dll".
SmartSAR -> d:\a\1\s\SmartSAR\bin\Release\netcoreapp3.1\SmartSAR.dll
Copying file from "d:\a\1\s\SmartSAR\obj\Release\netcoreapp3.1\SmartSAR.pdb" to "d:\a\1\s\SmartSAR\bin\Release\netcoreapp3.1\SmartSAR.pdb".
Did you set the Azure web app's general settings stack property to .NET Core?您是否将 Azure web 应用程序的常规设置堆栈属性设置为 .NET Core?
The issue was I used the default YAML generated for the build pipeline and I didn't notice it was targeting a Windows build image.问题是我使用了为构建管道生成的默认 YAML,但我没有注意到它针对的是 Windows 构建映像。 (I blame lack of sleep.) (我责怪睡眠不足。)
Here's the YAML I used for the final working pipeline:这是我用于最终工作管道的 YAML:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: ".NET Core 3.1.x"
inputs:
version: '3.1.x'
packageType: sdk
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: "Test"
inputs:
command: test
projects: '**/*tests/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: "Publish"
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-r linux-x64 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: "Upload Artifacts"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'WebApp'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.