azure - 从 Azure DevOps 部署到 Azure Linux 应用服务没有效果

标签 azure azure-devops azure-web-app-service azure-pipelines

我有一个Angular 8 + asp.net core 3.1由 Visual Studio 2019 生成的应用程序。

我尝试在 Azure Linux App Service 上按原样部署应用程序而不进行修改通过使用 VS 2019 Publish应用程序的部署没有任何问题,并且我可以通过 <app-name>.azurewebsites.net 上的 Web 浏览器访问该应用程序网址

使用 Azure App Service deploy 从 Azure 发布管道部署应用程序时任务,部署没有错误,但在请求 <app-name>.azurewebsites.net 时发生我得到的默认站点如下图所示 enter image description here

看来部署对 Azure DevOps 没有任何影响。我做错了什么?

详细信息

构建管道

trigger:
- master

pool:
  vmImage: 'windows-2019'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: Npm@1
  displayName: 'npm install'
  inputs:
    command: 'install'
    workingDir: 'MyApp/ClientApp'
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  displayName: 'nuget restore'
  inputs:
    restoreSolution: '$(solution)'
- task: Npm@1
  displayName: 'ng build'
  inputs:
    command: 'custom'
    workingDir: 'MyApp/ClientApp'
    customCommand: 'run build'

- task: DotNetCoreCLI@2
  displayName: 'dotnet build release'
  inputs:
    command: 'build'
    arguments: '-c $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    publishWebProjects: true
    arguments: '-r linux-x64 -c release --output $(build.ArtifactStagingDirectory)'
    
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact Website'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'MyAppDropDir'
    publishLocation: 'Container'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact ARM Template'
  inputs:
    PathtoPublish: '$(Build.SourcesDirectory)/MyApp.AppService'
    ArtifactName: 'ARMTemplate'
    publishLocation: 'Container'

发布管道

enter image description here

最佳答案

您可以做的一件事是转到已部署的 Web 应用程序的 Kudu 控制台,查看实际代码是否已部署。

例如:https://.scm.azurewebsites.net/,其中 name 是您的 Web 应用程序的名称。

据我所知,您需要在发布管道上设置启动命令为 dotnet aspnet-core-dotnet-core.dll

您可以尝试的另一件事是设置一个新的 DevOps 项目,然后用您的存储库替换源代码。您可以导航到 Azure 门户 -> Devops Project,您可以选择 .Net,然后选择 Core3 作为模板,看看出了什么问题

关于azure - 从 Azure DevOps 部署到 Azure Linux 应用服务没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59489489/

相关文章:

azure - 是否可以阻止来自某些 IP 地址的请求发送到 Application Insights?

azure - 无法使用 Azure DevOps 发布管道将 APK 发布到 Visual Studio App Center

Azure 开发运营 : work item type rules triggered by Board Column

python - 使用 python 客户端从 VM 创建镜像

python - 如何使用 Python SDK 将变量发送到 Azure 事件中心

git - Azure DevOps '401 - Uh-oh, you do not have access' 受邀用户

sql-server - Azure 网站连接到不同区域的 Azure SQL 数据库的性能问题

c# - 如何获得AAD群成员?

azure - 如何从应用程序访问法语和英语的自定义 Azure AD 登录页面?

c# - 通过 Windows 窗体 c# 将文件上传到 Blob