Solution to "can't be invoked from Azure WebJobs SDK. Is it missing Azure WebJobs SDK attributes?" when creating an Azure WebJob
I spent spent way too much time with this one. Hope this post saves you from doing the same.
Here’s the exception we are dealing with:
can’t be invoked from Azure WebJobs SDK. Is it missing Azure WebJobs SDK attributes?
I got this error when I was creating an on-demand WebJob. It should have take a few minutes to write the entire job, but the error message led me down a path and I put my blinders onto visibility issues. Based on the message, I spent a bunch of time researching Azure WebJobs attributes to no avail. I then broke the problem down by creating a new WebJob with only a few lines of code:
and I still got the issue. So I then did a line-by-line diff of a WebJob that was working and discovered that, by default, the WebJob VS template does not make the class public. So, I added the public keyword to the Program class and it fixed it. Here’s the code that will work:
It’s amazing how one little word can cause so much delay in a project.
Jon
Share on LinkedIn
Quick Share: Your custom post text has been copied to your clipboard! Click the button below to open LinkedIn's share dialog, then paste it.
💡 Tip: LinkedIn will open in a new tab. Use Ctrl+V (or Cmd+V on Mac) to paste your text.
Note: LinkedIn will show the article preview. You can add your custom text above it.