I am using Azure Function
v2. Here is my function that uses the constructor injection:
public sealed class FindAccountFunction
{
private readonl
You should remove the call of AddLogging
method from your startup class. The default logger is already setup by the azure function host.
[assembly: WebJobsStartup(typeof(StartUp))]
public class StartUp : IWebJobsStartup
{
public void Configure(IWebJobsBuilder builder)
{
builder.Services.AddSingleton();
builder.Services.AddTransient();
}
}
public MyFunction(IMyService service, ILogger logger)
{
this.service = service;
this.logger = logger;
}
Instance methods are now supported with azure function since Azure Functions Runtime 2.0.12265