According to this msdn link quoting
Remote debugging only works with continuous WebJobs. Scheduled and on-demand WebJobs don't support debugging.
Is there a way to remote debug azure on demand webjob?
I have VS 2017 Community.
I've tried attach to process to my website but as soon as my web job is called from my site. I loose debugging in VS.
Please help.
On-demand WebJobs (aka Triggered) only run when they are invoked (whether manually or on timer). So there is no running process to attach to outside of an invocation. And when the invocation starts, the process may not exist long.
One possible workaround if you really need to debug it on Azure would be to add a sleep on start that would give you enough time to attach before it starts doing real work. But that's certainly quirky.
You should also try debugging it locally, unless your issue only happens on Azure.