Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging an Azure Web App Web Job

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...

like image 234
DanielG Avatar asked Dec 23 '22 13:12

DanielG


1 Answers

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
like image 175
David Ebbo Avatar answered Jan 12 '23 01:01

David Ebbo