Publishing a web application on Azure sites Deployment slot splitting fails with webjob

I just created a new deployment slot for my application, I imported the publish profile in Visual Studio, but after the deployment I got this error message:

Error 8: An error occurred while creating the WebJob schedule: No website was found that matches WebSiteName [myapp__staging] and WebSiteUrl [ http://myapp-staging.azurewebsites.net] .

I have 2 webjobs, a continuous and planned website.

I have already entered the correct Azure account as indicated by this answer .

Do I need to install something else to deploy my application in an intermediate deployment slot with webjobs?

My application uses ASP.NET if that matters?

+4
source share
2 answers

Jeff,

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

Keep in mind that to use it, you need to install the package and WebJobs extensions, which are currently preliminary. You can get them on Nuget.

Microsoft.Azure.WebJobs -Pre Install-Package Microsoft.Azure.WebJobs.Extensions -Pre Installation

In addition, as David suggested, if you are not using the WebJobs SDK, you can also run it using the settings.job file. He gave 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.

UPDATE webjob-publish-settings.json

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"
}
+3

Azure Scheduler . CRON. .

+5

Source: https://habr.com/ru/post/1614339/


All Articles