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

posted @ 2021-09-28 17:01  富贵东坡  阅读(418)  评论(0编辑  收藏  举报