Azure WebJobs Walkthrough with Visual Studio


image

  1. Create an ASP.NET WebApp
  2. At project node, Add “New Azure WebJob Project”
  3. Choose project type: Continuous/OnDemand/Schedule
    1. Continuous:
      1. A JobHost.RunAndBlock(); in void Main().
      2. A method for [QueueTrigger/BlobTrigger(queuename)] to dequeue message from queue
    2. On Demand/Schedule:
      1. A JobHost.Call(methodname, value) in void Main().
      2. A method for [Queue/Blog(queuename)] to enqueue  message to the queue
  4. Publish WebApp and/or WebJob projects to Azure. And you will find the WebJob deployed under the WebApp App_Data folder
  5. Configuration: Add Azure Storage Connection String to Live Azure Web Site.
    1. Go to Server Explorer –> Storage to get Storage Connection String
      • image
      • image
    2. Go to  Websites –> Settings, create 2 entries AzureWebJobsStorage & AzureWebJobsDashboard. And select Custom from the Database Type column.
      • image
  6. Debug Contiuous WebJob: In Server Explorer, goto your WebJob and make sure it is started.
    1. Attach Debugger. Set your breakpoints.
      1. image
    2. View static Logs.
  7. Run OnDemand WebJob to send message to the queue which will in turn trigger any breakpoints in the continuous WebJob.
    1. image

Ref:

https://github.com/Azure/azure-webjobs-sdk-samples

http://blogs.msdn.com/b/webdev/archive/2014/11/12/new-developer-and-debugging-features-for-azure-webjobs-in-visual-studio.aspx

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s