4
votes

I have an Azure WebJob that I created from the WebJobSDK, Service Bus monitor. Basically the WebJob continually monitors a Service Bus, processes the message, and continues looking for new messages. When I debug (F5) the application locally, the process works perfectly. It basically grabs the message from the Bus, transposes it into an XML file, copies that file to an Azure BLOB container, and then call Azure SQL to insert a control row.

My problem is that when I publish the WebJob, I have an error that I don't know how to debug. I can look at the Service Bus messages and see that the process is peeking the message, failing, doing that 9 more times, and then the messages goes into the dead message queue. That is expected when a message is peeked 10 times and never completed (I left this defaulted to 10), so I know my process is running but failing abnormally.

I have Try/Catches around all of my code. What do I need to place within the Catch to have something surfaced in the Azure Portal so I can debug what is wrong? I actually have a call in the catch handler that reads the exception.InnerException and attempts to write it to a DB table, but surprisingly, that never happens.

I appreciate any insight. Thanks a lot...

1
you can do remote debugging with azure webjobs. google around you will find resources which shows step by step how to do it. an example : opsgility.com/blog/2016/06/22/…akd

1 Answers

10
votes

You can do this as follows:

  • In VS, go to Cloud Explorer (make sure you have the latest Azure tools)
  • Find your Web App under App Service
  • Under it, go under WebJobs and find your Continuous WebJob
  • Right Click it and choose Attach Debugger