Azure Functions App - not executing for unknown reason

Tomáš Iša 5 Reputation points
2023-05-03T05:44:52.5466667+00:00

Hello,

Since 1st of May at around 9:30 PM we started having problems with our Azure Functions App which completely stopped executing timer functions.

The error shown is **"**System.InvalidOperationException: Unable to resolve service for type 'XXX.DbContext' while attempting to activate 'FunctionName'."

The problem is that the functions have been running since last year with absolutely no issues and we haven't made any changes to our code for at least 140 days (based on Visual Studio). The database is also accesible and up and running. There also weren't any changes to firewall rules. And all invoices are paid.

Do you have any tips how to make this reliable again? We managed to make it work after restarting app, or changing value of WEBSITE_RUN_FROM_PACKAGE to something and then back to 0. But after a while it just stops again.

Here is a picture of the function execution count for the last 7 days.

User's image

Thank you for any input.

Best Regards

TI

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

1 answer

Sort by: Most helpful
  1. Tomáš Iša 5 Reputation points
    2023-05-04T10:27:14.89+00:00

    For anyone who might be dealing with the same problem here is what worked for me:

    Make sure host.json file is up to date in Azure. I had to remove Microsoft.Azure.Functions.ExtensionBundle reference from host.json and then I had to set .csproj of the project to always upload host.json on Publish. After this file got updated everything started working again.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.