Hello @Tri Nguyen
The error message you mentioned here suggests that you should make your job classes and methods public. In your code, you have defined a public class TimeIntervalFunctionClass
, but the Run
method is not public.
You should make the Run
method public so that it can be discovered by the Azure Functions runtime. Here's an updated version of your code with the Run
method made public:
module Functions
open Domain
open Microsoft.Azure.Functions.Worker
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.Logging
// I need dependency injection but this doesn't work
type public TimeIntervalFunctionClass() = [] member public _.Run ([] myTimer: TimerInfo) (context: FunctionContext) =
let logger = context.GetLogger(classlogger)
logger.LogInformation("timer trigger in class")
Note that I also added quotes around the log message in the Run
method.
I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.