【发布时间】:2022-01-02 13:28:39
【问题描述】:
我有基于 .NET Core 2.2 的微服务。我使用 RawRabbit(版本 2.0.0-beta9)作为服务总线。与它一起安装了以下软件包:
<PackageReference Include="RawRabbit" Version="2.0.0-beta9" />
<PackageReference Include="RawRabbit.DependencyInjection.ServiceCollection" Version="2.0.0-beta9" />
<PackageReference Include="RawRabbit.Operations.Publish" Version="2.0.0-beta9" />
<PackageReference Include="RawRabbit.Operations.Subscribe" Version="2.0.0-beta9" />
这是我的控制器的样子:
private readonly IBusClient _busClient;
//...constructor that inits the _busClient
[HttpPost("")]
public async Task<IActionResult> Post([FromBody] CreateActivity model)
{
model.Id = Guid.NewGuid();
await _busClient.PublishAsync(model); //Exception thrown here
return Accepted($"Activities/{model.Name}");
}
当代码尝试执行以下操作时会出现问题:
await _busClient.PublishAsync(model);
我得到的例外是:
找不到方法:'Void Newtonsoft.Json.JsonSerializer.set_TypeNameAssemblyFormat(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)'。
【问题讨论】:
-
我很困惑,你的标题说你有一个 .NET Core 5 项目,但描述说的是 .NET Core 2.2!
标签: c# asp.net-core .net-core microservices csharpcodeprovider