.净核心5RawRabbit器/依赖注射问题

0

的问题

我有微服务的基础上。净核心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);

除我是:

方法不会发现:'无效Newtonsoft.Json.JsonSerializer.set_TypeNameAssemblyFormat(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)'.

1

最好的答案

0

看来这不是关于你的消息经纪人或发布(由的方式,它可能会更好,如果你提到的消息是否收到你的消费者或不) 但是,似乎某个地方你都使用TypeNameAssemblyFormat在牛顿JSON其是过时的,现在按 这里.

[ObsoleteAttribute("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
public FormatterAssemblyStyle TypeNameAssemblyFormat { get; set; }

你应该使用TypeNameAssemblyFormatHandling. 还看到 这里

2021-11-29 20:34:02

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................