Webjob deployment experience with Visual Studio

When it comes about IDE, I bet nothing could give such fluent experience like Visual Studio. In this post I will boost up our existing Azure Webjobs Deployment experience with the power of Visual Studio. But for that we will requires Visual Studio 2013 or above with Azure SDK version 2.4 minimum.

In VS when I go to create New Project by clicking File>New Project, I see numbers of template are available under Cloud section. But I am particularly interested in the template named “Microsoft Azure WebJob” .


Select the template and create a project with your preferred name. Looking at the project structure (more specifically Program.cs file) you might be thinking this template is identical with our regular console application template. Yes, its almost identical. To find out the hidden treasure this template offers, right click the project and you will see “Publish as Azure WebJob…” button in the context menu.


Clicking on “Publish as Azure WebJob…” button will open up a new dialog box from where you can easily configure your webjob settings. The setting include webjob name, its running mode and so on.


Once you are done with the configure click the OK button to proceed. This will take you to the Publish Web dialog box where you will basically hook your webjobs with a web app. Clicking the Publish button will publish your webjobs.

” Use this template for an independent WebJob ! i.e. when you want to run a WebJob in a web app by itself, with no web application attached with it.”

Independent WebJob scenario comes into play when you might want to to scale your WebJob resources independently of your web application resources.

Where the Webjob file actually exists?

While its true I can relay on portal and Visual Studio to deploy webjobs, there might come situation when we will need the physical path of your webjobs. A WebJob is stored under the following directory in your site :

site\wwwroot\App_Data\jobs{job type}{job name}

{job type} -> could be either continuous (job that is always running)  or triggered job that starts from an external trigger (on demand / scheduler).
{job name} -> Your WebJob’s name.

For each scheduled WebJob VS create an Azure Scheduler job collection (if one doesn’t exist already). The naming convention for

  • The scheduler job collection is named WebJobs-{regionname}.
    {regionname} -> The region where the web app is hosted in.
  • The scheduler job is named {webappname}-{job name} .
    {job name} -> Your WebJob’s name.

Note: A WebJobs enabled project has the following items added to it:

  1. The Microsoft.Web.WebJobs.Publish NuGet package.
  2. A webjob-publish-settings.json file that contains deployment and scheduler settings.

Wrapping Up :

Pay close attention on the following fact :

  • If your Azure Web Sites site is running on multiple instances and you create a new continuous WebJob, the WebJob will run on all instances by default! On its contrary, triggered WebJob will run on just one instance selected at random !
  • If you want your continuous WebJob to run on only one instance, then you have tweak the Setting.json file with the { “is_singleton”: true } .
  • If you set { “is_singleton”: truefor triggered/schedule job then strange behavior may occur!

If a schedule occurrence is missed or fails by any reason, the runtime will try to get back on schedule by running the function again. Find details here in source code.

Reference :


One thought on “Webjob deployment experience with Visual Studio

  1. Pingback: Azure Webjob ebook is on the way ! | LearnWithShahriar

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s