使用VSTS部署Azure WebJob [英] Deploy Azure WebJob using VSTS

查看:64
本文介绍了使用VSTS部署Azure WebJob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio Team Services(VSTS)部署Azure WebJob时遇到一些问题.

I'm having some issues deploying an Azure WebJob using Visual Studio Team Services (VSTS).

WebJob似乎已成功部署,但是它破坏了在同一App Service中托管的Azure网站!如果我使用VS2013进行部署,我不会遇到此问题.

The WebJob seems to be deployed successfully but it breaks the Azure website that is hosted in the same App Service! I don't have this problem if I deploy using VS2013.

这是生成WebJob部署程序包的构建任务:

This is my build task that generates the WebJob deployment package:

这是我的部署任务:

部署Azure WebJob时没有错误.如果我转到Azure门户,我会看到WebJob在其中,并且运行成功. WebJob文件将按预期复制到wwwroot\App_Data\jobs\triggered\RemoveExpiredDids文件夹中,但是问题是某些其他文件将被复制到wwwroot\App_Data\bin文件夹中,这将破坏已经部署到该App Service中的现有网站!!!

There are no errors when I deploy the Azure WebJob. If I go to the Azure Portal I see the WebJob is there, and it runs successfully. WebJob files are copied into the wwwroot\App_Data\jobs\triggered\RemoveExpiredDids folder as expected, but the problem is that some other files will be copied into the wwwroot\App_Data\bin folder, which will break the existing website that was already deployed into that App Service!!!

所以我决定找出原因.下载并解压缩部署程序包后,我看到有2个文件夹(app_databin)和调度程序文件(settings.job):

So I decided to find out why this was happening. After downloading and extracting the deployment package I saw there are 2 folders (app_data and bin) and the scheduler file (settings.job):

这说明了为什么将某些程序集复制到App Service的wwwroot\App_Data\bin中.奇怪的是,从VS2013部署时不会发生这种情况!!!我查看了MSBuild日志,发现以下行:

This explains why some assemblies are coppied into the wwwroot\App_Data\bin of the App Service. The strange thing is that this doesn't happen when deploying from VS2013!!! I took a look into the MSBuild log and found the following line:

由于跳过指令'SkipBinFolderOnDeploy',对象dirPath([应用程序服务名称] \ bin)被跳过.

Object dirPath ([app service name]\bin) skipped due to skip directive 'SkipBinFolderOnDeploy'.

结论:从VSTS部署Azure WebJob时包含bin文件夹,而从VS2013部署时不包括bin文件夹.

Concluding, bin folder is included when deploying the Azure WebJob from VSTS but is excluded when deploying it from VS2013.

所以我的问题是:在使用VSTS时如何防止bin文件夹被部署?是否有任何MSBuild参数/标志可以做到这一点?

So my question is: how to prevent the bin folder from being deployed when using VSTS? Is there any MSBuild parameter/flag to do this?

推荐答案

请参阅以下将webjob部署到天蓝色的方法:

Refer to these ways to deploy webjob to azure:

  1. 修改Visual Studio Build任务以使用 FileSystem 部署Webjob(MSBuild参数:/p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\WebJob" /p:DeployDefaultTarget=WebPublish)
  2. 添加删除文件任务以释放定义以删除bin文件夹(源文件夹:$(System.DefaultWorkingDirectory)/WebJobVnext/drop/WebJob);内容:bin)
  3. 修改Azure App Service部署任务(1.取消选中使用Web Deploy发布选项.2.程序包或文件夹:$(System.DefaultWorkingDirectory)/[artifact name] /drop/WebJob)
  1. Modify Visual Studio Build task to deploy webjob with FileSystem (MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\WebJob" /p:DeployDefaultTarget=WebPublish)
  2. Add Delete Files task to release definition to delete bin folder (Source Folder: $(System.DefaultWorkingDirectory)/WebJobVnext/drop/WebJob); Contents:bin)
  3. Modify Azure App Service Deploy task (1. Uncheck Publish using Web Deploy option. 2. Package or folder: $(System.DefaultWorkingDirectory)/[artifact name] /drop/WebJob)

这篇关于使用VSTS部署Azure WebJob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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