副本在API调用中有多个失败:IStatelessServiceInstance.Open()

时间:2017-02-13 17:09:51

标签: azure-service-fabric

我遇到Service Fabric Explorer中的以下异常:

Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false.
Replica had multiple failures in API call: IStatelessServiceInstance.Open(); Error = System.Reflection.TargetInvocationException (-2146232828)
Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at FRSecure.AssessmentDesigner.Web.WebHostBuilderHelper.GetWebHost(IWebHostBuilder webHostBuilder, String protocol, String port, String environment) in D:\a\1\s\web_assessmentdesigner\WebHostBuilderHelper.cs:line 16
   at web_assessmentdesigner.WebHostingService.Microsoft.ServiceFabric.Services.Communication.Runtime.ICommunicationListener.OpenAsync(CancellationToken cancellationToken) in D:\a\1\s\web_assessmentdesigner\WebHostingService.cs:line 75
   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__0.MoveNext()

以下是我所知道的:

  1. 应用安装并在本地群集上正常运行,但不在Azure上运行。
  2. 该应用程序包含无状态api和有状态服务。有状态的服务很好。大约2分钟后,无国籍人进入失败状态。
  3. 我的问题是:如何或在哪里可以获得有关基础异常的更多信息?该服务在启动之前失败,因此我的日志记录尚未可用。我在门户网站上的诊断中看不到任何内容。当它无法在本地复制时,解决这类问题的最佳方法是什么?

1 个答案:

答案 0 :(得分:3)

如果您已启用事件提供程序Microsoft-ServiceFabricGuid = "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8")向Diagnostics发送事件,那么您应该能够看到与此相关的一些事件,类StatelessServiceInstanceAdapter调用WebHostBuilderHelper时,如果遇到上述例外情况,就会发出类似Got exception when opening communication listeners - XXX之类的事件,这可能会提供有关服务失败原因的更多信息。

您还可以简单地将WebHostBuilderHelper.GetWebHost(...)实施包装在try / catch中,并记录捕获到ServiceEventSource的所有异常。当服务试图打开监听器时会发生异常,但从上面的原因不清楚。