使用azure devops管道将控制台webjob应用程序部署到包含webapi的azure App服务 [英] Deploy console webjob app to azure App service containing a webapi using azure devops pipelines

查看:163
本文介绍了使用azure devops管道将控制台webjob应用程序部署到包含webapi的azure App服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个用.net core 2.2编写的webAPI。这2个Web api是由.netcore 2.2中的控制台应用程序web作业触发的。它们都是不同的项目,并且位于Azure DevOps中的不同存储库中。



我正在尝试将Web Api和Webjob一起部署到2个Web应用程序服务中(例如:WebApi1 +在Azure中使用Azure DevOps构建和发布管道将Web作业1转换为App service1,将Web job2 + Web job2转换为App service2)。



我能够从Azure门户手动将webjobs添加到App Service中,并且工作正常。但是我想使用Azure DevOps管道进行部署。



我尝试了多种方法来使用应用程序服务中的Web api发布Web作业(控制台应用程序),例如尝试将其从Azure DevOps发布到App_Data文件夹。



我主要关注以下博客。





我的构建步骤:






我的发布步骤:





我不确定自己做错了什么。
是否可以将webjobs文件复制到相同的应用程序服务中而不会覆盖实际的webapi代码?

解决方案

我在github回购上问了一个问题


  1. 在DevOps中配置构建管道,例如:


  2. 配置发布管道,例如:


配置任务:




I have 2 webAPI’s written in .net core 2.2.The 2 web api’s are triggered by web jobs which are console Apps in .netcore 2.2. They are all different projects and in different repositories in Azure DevOps.

I am trying to deploy the web Api's together with the webjob into 2 web app services(eg: WebApi1 + Web job1 into App service1 and WebApi2 + Web job2 into App service2) in Azure using the Azure DevOps build and release pipelines.

I am able to add the webjobs manually into App Service from Azure portal and it works fine.But I want to deploy it using Azure DevOps pipelines.

I tried different ways to publish the web jobs(console apps) with the web api in the app service, like trying to publish it to App_Data folder from Azure DevOps.

I mainly followed the blog below.

https://www.andrewhoefling.com/Blog/Post/deploying-dotnet-core-webjobs-to-azure-using-azure-pipelines

But when I try to publish the webjob it overwrites the web api code(all the 4 projects have seperate build/release pipelines). The webjob code gets deployed in the site/wwwroot folder rather than the site/job folder.

My Build steps:

My Release steps:

I am not sure what I am doing wrong. Is there a way to copy the webjobs files into the same app service without overwritting the actual webapi code?

解决方案

I asked this question a while on github repo azure-webjobs-sdk but the answer didn't help me as well...

i tried the following and it worked out for me:

  1. In Azure Portal navigate to: App Service > Configuration > Path mappings > Virtual applications and directories

  1. In DevOps configure your build pipeline like:

  2. configure your release pipeline like:

configure the task:

这篇关于使用azure devops管道将控制台webjob应用程序部署到包含webapi的azure App服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆