Cannot find AddRefitClient method for Worker Service

1.8k views Asked by At

Currently I using .NET version 7 to do background job service. I add Worker Service project, in Program.cs file I cannot call method AddRefitClient although I add package Refit to call API. I don't want to use HttpClient

This is error message:

'IServiceCollection' does not contain a definition for 'AddRefitClient' and no accessible extension method 'AddRefitClient' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

enter image description here

1

There are 1 answers

1
Abusive Vids On

You also need the package Refit.HttpClientFactory to install.