简体   繁体   English

指定分配给计划的Azure WebJob的作业集合

[英]Specifying the Job Collection that a scheduled Azure WebJob is assigned to

Is it possible to specify what job collection Visual Studio should use when it deploys an Azure Web Job with a schedule? 是否可以指定Visual Studio在按计划部署Azure Web Job时应使用的作业集? By default it tries to create a new Free tier collection, but as I already have one (and the limit is one per account), it fails to deploy. 默认情况下,它尝试创建一个新的免费层集合,但是由于我已经有一个(层数限制为每个帐户一个),因此部署失败。

I want to set up a paid job collection, and have all my deployments go into that collection. 我想设置一个有薪工作集合,并将所有部署都放入该集合中。

I am deploying the WebJob from Visual Studio's Publish as Azure WebJob... option. 我正在从Visual Studio的“ Publish as Azure WebJob...选项中部署WebJob。 The error message in Visual Studio is: Visual Studio中的错误消息是:

An error occurred while creating the WebJob schedule: The subscription 'XXX' cannot have more than '1' free job collections. 创建WebJob计划时发生错误:预订“ XXX”的免费作业集合不能超过“ 1”。 (/subscriptions/XXX/resourceGroups/CS-WestEurope-scheduler/providers/Microsoft.Scheduler/jobCollections/YYY) (/subscriptions/XXX/resourceGroups/CS-WestEurope-scheduler/providers/Microsoft.Scheduler/jobCollections/YYY)

I want to keep my existing free job collection (as it has other manually created HTTP jobs in it). 我想保留我现有的免费作业集合(因为其中包含其他手动创建的HTTP作业)。 It would be much better if I could specify myself where the WebJob schedule should go. 如果我可以指定自己的WebJob时间表应该会更好。

Thanks! 谢谢!

I have managed to work around this for now. 我现在已经设法解决此问题。 I performed the following steps: 我执行了以下步骤:

  1. Remove my existing Free tier Job Collection in the Azure Portal website. 在Azure门户网站中删除我现有的Free tier Job Collection。
  2. Deploy one or more of my new WebJobs from Visual Studio (including schedule information). 从Visual Studio部署我的一个或多个新WebJob(包括计划信息)。
  3. Return to the Azure Portal website, and change the Scale tab of the job collection from Free as it was created by Visual Studio to a Standard/Premium version. 返回到Azure Portal网站,并将作业集合的“缩放”选项卡从Visual Studio创建的“免费”更改为“标准/高级”版本。
  4. In the Azure Portal website, create a new (free) Job Collection, and re-add my existing manually created HTTP jobs to it. 在Azure门户网站中,创建一个新的(免费)作业集合,然后向其中重新添加我现有的手动创建的HTTP作业。

Once this is done, deployments from Visual Studio go to the automatically created Job Collection (automatically named WebJobs-WestEurope after the geolocation of my app), and the other collection is left alone for you to use how you wish. 完成此操作后,从Visual Studio进行的部署将转到自动创建的Job Collection(在我的应用程序地理位置定位后自动命名为WebJobs-WestEurope),而其他集合则留给您使用,以供您使用。

Basically, Visual Studio needs to get in FIRST to create it's collection, and after that you can add collections as you wish. 基本上,Visual Studio首先需要创建它的集合,然后您可以根据需要添加集合。 It seems like a limitation that you can't control which collection it chooses though, so you have to remember that a particular collection is magically tied to Visual Studio's deployments. 似乎无法控制它是一个限制,但是您必须记住特定的集合与Visual Studio的部署紧密地联系在一起。 I'm all for convention over configuration, but not convention DISALLOWING configuration. 我全都赞成约定优于配置,而不是约定DISALLOWING配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM