Azure выпуск конвейера публикуется sh в NetCore 3.1 linux Служба приложений завершается ошибкой с кодом выхода 145 - «Невозможно найти какие-либо. NET Core SDK» в журнале - PullRequest
0 голосов
/ 18 апреля 2020

Я публикую приложение. net core 3.1, которое сохранено в репо Azure DevOps, встроено в конвейер сборки и опубликовано в контейнере Azure Linux Службы веб-приложений. Кажется, что весь процесс выглядит хорошо go, и в соответствии с блейдом развертывания в службе приложений развертывание прошло успешно.

Ожидаемый результат

Я ожидаю увидеть мой развернутый веб-сайт, когда я go перейду на URL c publi.

Actual Результат

Вместо этого я вижу новую страницу хоста, на которой написано: «Эй, NET Разработчики ядра! Ваша служба приложений запущена и работает. Время сделать следующий шаг и развернуть код».

Дополнительная информация

Похоже, что служба приложений запускает приложение по умолчанию, так как при запуске моего опубликованного приложения возникла проблема.

Команда запуска I В общей конфигурации службы приложения указано:

dotnet "SmartSAR.dll"

Журнал запуска службы приложения

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

Сборка конвейера 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

Сгенерированный артефакт - это дроп, содержащий файл развертывания WebApp.zip (плюс связанные файлы).

Из того, что я могу сказать, генерируемая dll, которую мне нужно запустить, - это SmartSAR .dll. Из журнала сборки:

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".

Ответы [ 2 ]

0 голосов
/ 18 апреля 2020

Проблема была в том, что я использовал YAML по умолчанию, сгенерированный для конвейера сборки, и я не заметил, что он нацелен на Windows образ сборки! (Я виню в недостатке сна.)

Вот 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' 
0 голосов
/ 18 апреля 2020
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...