我正在尝试为使用 SQL Server 的 Orleans 设置一个测试环境。这是我的服务器配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<OrleansConfiguration xmlns="urn:orleans">
<Globals>
<Liveness LivenessType="SqlServer" DeploymentId="42783519-d64e-44c9-9c29-111111111133" DataConnectionString="Data Source=.\\SQLEXPRESS;Initial Catalog=Orleans;Integrated Security=True;" />
<!--<SeedNode Address="localhost" Port="11111" />-->
</Globals>
<Defaults>
<Networking Address="localhost" Port="11111" />
<ProxyingGateway Address="localhost" Port="30000" />
<Tracing DefaultTraceLevel="Info" TraceToConsole="true" TraceToFile="{0}-{1}.log">
<TraceLevelOverride LogPrefix="Application" TraceLevel="Info" />
</Tracing>
<Statistics MetricsTableWriteInterval="30s" PerfCounterWriteInterval="30s" LogWriteInterval="300s" WriteLogStatisticsToTable="true" />
</Defaults>
<Override Node="Primary">
<Networking Address="localhost" Port="11111" />
<ProxyingGateway Address="localhost" Port="30000" />
</Override>
</OrleansConfiguration>
当我使用这个配置时,我在运行时遇到了这个错误:
MembershipTableGrain cannot run without Seed node - please check your silo configuration file and make sure it specifies a SeedNode element. Alternatively, you may want to use AzureTable for LivenessType. Parameter name: grain = MembershipTableGrain Exception = System.ArgumentException: MembershipTableGrain cannot run without Seed node - please check your silo configuration file and make sure it specifies a SeedNode element. Alternatively, you may want to use AzureTable for LivenessType.
更进一步,日志显示 Liveness 是 MembershipTableGrain(这是默认值并且需要 SeeNode)。我在这里缺少什么?
最佳答案
我的 SQLServer 成员资格的筒仓配置如下所示
<?xml version="1.0" encoding="utf-8"?>
<OrleansConfiguration xmlns="urn:orleans">
<Globals>
<SystemStore SystemStoreType="SqlServer" DeploymentId="YYYYY" DataConnectionString="Server=THESERVER;Database=Orleans;User ID=USER;password=PASSWORD;"/>
</Globals>
<Defaults>
<Networking Address="" Port="11111"/>
<ProxyingGateway Address="" Port="30000"/>
</Defaults>
</OrleansConfiguration>
无需指定活体类型。它通过查看 SystemStoreType 来计算。
客户端配置确实需要指定网关
<ClientConfiguration xmlns="urn:orleans">
<SystemStore SystemStoreType ="SqlServer"
DeploymentId="YYY"
DataConnectionString="Server=THESERVER;Database=Orleans;User ID=USER;password=PASSWORD;" />
<GatewayProvider ProviderType="SqlServer"/>
</ClientConfiguration>
关于c# - Orleans 为Liveness指定SqlServer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34620854/