在调用Orleans.GrainClient.GetStreamProviders()和Orleans.GrainClientGetStream()后,我收到了System.NullReferenceException。我尝试在文件配置和代码中添加StreamPorvider。 GetGrain()等其他方法效果很好。
我的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<!--
This is a sample client configuration file.
For a detailed reference, see "Orleans Configuration Reference.html".
-->
<ClientConfiguration xmlns="urn:orleans">
<GatewayProvider ProviderType="Config"/>
<Gateway Address="localhost" Port="30000"/>
<Statistics MetricsTableWriteInterval="30s" PerfCounterWriteInterval="30s" LogWriteInterval="300s" WriteLogStatisticsToTable="true"/>
<StreamProviders>
<Provider Type="Orleans.Providers.Streams.SimpleMessageStream.SimpleMessageStreamProvider" Name="PubSubType" FireAndForgetDelivery="false"/>
<!--<Provider Type="Orleans.Providers.Streams.Persistent.AzureQueueStreamProvider" Name="AzureQueueProvider" DataConnectionString=""/> -->
</StreamProviders>
</ClientConfiguration>
和错误堆栈跟踪
[HttpException(0x80004005):对象引用未设置为对象的实例。]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9964625
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Object reference not set to an instance of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946132
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
答案 0 :(得分:0)
您需要在您的silo配置中使用相同的Streams配置,而不仅仅是客户端。 检查名称和所有参数是否匹配(复制\粘贴部分;))