orleans 报错 System.ArgumentException:“Cannot find an implementation class for grain interface: xxx. Make sure the grain assembly was correctly deployed and loaded in the silo.”

nuget 已安装包:Microsoft.Orleans.Server,Microsoft.Orleans.OrleansProviders

program已配置Orleans:

await Host.CreateDefaultBuilder(args)
    .UseOrleans(builder =>
    {
        builder.UseLocalhostClustering();
        builder.AddMemoryGrainStorageAsDefault();
        builder.AddSimpleMessageStreamProvider("SMS");
        builder.AddMemoryGrainStorage("PubSubStore");
    })
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder.UseStartup<Startup>();
    })
    .RunConsoleAsync();

在client获取grains时爆出错误 System.ArgumentException:“Cannot find an implementation class for grain interface:ITodoGrain. Make sure the grain assembly was correctly deployed and loaded in the silo.”

var grain = _client.GetGrain<ITodoGrain>(key);

 解决方案:

  添加nuget包:Microsoft.Orleans.CodeGenerator.MSBuild

原文地址:https://www.cnblogs.com/jidanfan/p/15348801.html