Cannot find AddRefitClient method for Worker Service

huangapple go评论63阅读模式
英文:

Cannot find AddRefitClient method for Worker Service

问题

I understand your request. Here's the translated content:

目前我正在使用.NET 7版本来执行后台作业服务。我添加了Worker Service项目,在Program.cs文件中,虽然我添加了Refit包来调用API,但我无法调用AddRefitClient方法。我不想使用HttpClient。

这是错误信息:

'IServiceCollection' 不包含名称为 'AddRefitClient' 的定义,并且找不到接受类型为 'IServiceCollection' 的第一个参数的可访问扩展方法 'AddRefitClient'(您是否缺少使用指令或程序集引用?)

Cannot find AddRefitClient method for Worker Service

英文:

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?)

Cannot find AddRefitClient method for Worker Service

答案1

得分: 5

你还需要安装Refit.HttpClientFactory包。

英文:

You also need the package Refit.HttpClientFactory to install.

huangapple
  • 本文由 发表于 2023年4月17日 09:54:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76031238.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定