2

在调用 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
4

1 回答 1

0

您需要在筒仓配置中具有相同的 Streams 配置,而不仅仅是客户端。检查名称和所有参数是否匹配(复制\粘贴该部分;))

于 2016-07-02T05:54:15.180 回答