如何使简单的状态持久化在 MS Orleans 中起作用?

How to make simple state presistance work in MS Orleans?

我已经安装了 Orleans SDK/Orleans VS 工具。我创建了所有三个项目(Grain、Interface 和 Silo)。我正在尝试 运行 他们作为 DevTest 主持人。我正在关注 pluralsight video 中的一个示例(它显然已经过时了)并且在几乎没有帮助的情况下我能够达到 presistence。为了使持久性工作,我需要一个服务器配置文件。我copied the file and dropped it in the Silo project but for some reason, Orleans can not find it. I checked in the code in Git if anyone want to see it in its current form

我们在 1.2.0 中将模板和示例切换为编程配置。这是在您的代码中完成筒仓配置的位置 - https://github.com/ksunair/IoT.Things/blob/master/IoT.TestSilo/OrleansHostWrapper.cs#L137. You can use Chirper sample as an example - https://github.com/dotnet/orleans/tree/master/Samples/Chirper.

去过那里..

"I need a server configuration file. I copied the file and dropped it in the Silo project but for some reason, Orleans can not find it."

如果您在 Silo 项目中包含一个 XML 文件,它将位于基本目录中。 Silo 可执行文件需要在其运行时位置找到它。确保将实际副本配置为 bin\debug。添加 XML 后,您需要在解决方案资源管理器中更改 属性 "Copy To Output Directory"。

右键单击 XML,转到属性,然后将其从 "Do not Copy" 更改为 "Always Copy"。