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