发布的Web应用程序天青网站分期部署插槽失败

发布的Web应用程序天青网站分期部署插槽失败

本文介绍了发布的Web应用程序天青网站分期部署插槽失败,webjob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个新的部署插槽我的应用程序,导入发布配置文件到Visual Studio,但部署后我收到此错误信息:

I just created a new deployment slot for my app, imported the publishing profile to Visual Studio, but after deployment I get this error message:

错误8:创建WebJob时间表时出现错误:没有网站可以发现它匹配WebSiteName [myapp__staging]和WebSiteUrl [的提供。

我有2 webjobs,连续和计划webjob。

I have 2 webjobs, a continuous and a scheduled webjob.

我已经登录到正确的Azure账号,由this回答。

I already signed in to the correct Azure account, as stated by this answer.

我将需要为了设置别的东西到我的应用程序部署到具有webjobs分段部署插槽?

Will I need to set something else up in order to deploy my app to a staging Deployment Slot with webjobs?

我的应用程序使用ASP.NET,如果它的确与众不同?

My app is using ASP.NET, if it makes a difference?

推荐答案

杰夫,

正如David所说,你可以/应该迁移到新的CRON支持。下面是一个例子。该WebJob将被部署为连续WebJob。

As David suggested, you can/should migrate to the new CRON support. Here's an example. The WebJob will be deployed as a continuous WebJob.

请,为了使用这个你需要安装WebJobs包和扩展,目前一$ P $租赁前。你可以让他们上的NuGet。

Keep in mind that in order to use this you need to install the WebJobs package and extensions that are currently a prerelease. You can get them on Nuget.

安装封装Microsoft.Azure.WebJobs - pre
  安装封装Microsoft.Azure.WebJobs.Extensions - pre

此外,如大卫,如果你不使用WebJobs SDK的建议,你也可以使用的 settings.job 的文件中运行此。他提供了一个示例

Also, as David suggested if you're not using the WebJobs SDK, you can also run this using a settings.job file. He provided an example here.

的Program.cs

static void Main()
{
    //Set up DI (In case you're using an IOC container)
    var module = new CustomModule();
    var kernel = new StandardKernel(module);

    //Configure JobHost
    var storageConnectionString = "your_connection_string";
    var config = new JobHostConfiguration(storageConnectionString) { JobActivator = new JobActivator(kernel) };
    config.UseTimers(); //Use this to use the CRON expression.

    //Pass configuration to JobJost
    var host = new JobHost(config);
    // The following code ensures that the WebJob will be running continuously
    host.RunAndBlock();
}

Function.cs

public class Functions
{
    public void YourMethodName([TimerTrigger("00:05:00")] TimerInfo timerInfo, TextWriter log)
    {
        //This Job runs every 5 minutes.
        //Do work here.
    }
}

您可以在 TimerTrigger 属性更改日程安排。

You can change the schedule in the TimerTrigger attribute.

更新新增了webjob - 发布 - settings.json文件

UPDATE Added the webjob-publish-settings.json file

这里的webjob-publiss-settings.json的例子

Here's an example of the webjob-publiss-settings.json

{
  "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
  "webJobName": "YourWebJobName",
  "startTime": null,
  "endTime": null,
  "jobRecurrenceFrequency": null,
  "interval": null,
  "runMode": "Continuous"
}

这篇关于发布的Web应用程序天青网站分期部署插槽失败,webjob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 01:50