副本在 API 调用中多次失败:IStatelessServiceInstance.Open()
Replica had multiple failures in API call: IStatelessServiceInstance.Open()
我遇到了来自 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\s\web_assessmentdesigner\WebHostBuilderHelper.cs:line 16
at web_assessmentdesigner.WebHostingService.Microsoft.ServiceFabric.Services.Communication.Runtime.ICommunicationListener.OpenAsync(CancellationToken cancellationToken) in D:\a\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()
这是我所知道的:
- 应用程序在本地集群上安装和运行良好,但在 Azure 上却不行。
- 该应用程序由无状态 api 和有状态服务组成。有状态服务启动正常。大约 2 分钟后无状态进入失败状态。
我的问题是:如何或在哪里可以获得有关底层异常的更多信息?该服务在启动之前失败,因此我的日志记录尚不可用。我在门户网站的“诊断”中看不到任何内容。当无法在本地复制此类问题时,解决此类问题的最佳方法是什么?
如果您已启用事件提供程序 Microsoft-ServiceFabric
(Guid = "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8"
) 将事件发送到 Diagnostics,那么您应该能够看到一些与此相关的事件,class StatelessServiceInstanceAdapter
正在调用您的 WebHostBuilderHelper
时,当它遇到上述异常时,它应该发出类似 Got exception when opening communication listeners - XXX
的事件,这可能包含有关您的服务失败原因的更多信息。
您也可以简单地将您的 WebHostBuilderHelper.GetWebHost(...)
实现包装在 try/catch 中,并记录您的 ServiceEventSource
捕获的任何异常。服务试图打开监听器时出现异常,但从上面的原因还不清楚。
我遇到了来自 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\s\web_assessmentdesigner\WebHostBuilderHelper.cs:line 16
at web_assessmentdesigner.WebHostingService.Microsoft.ServiceFabric.Services.Communication.Runtime.ICommunicationListener.OpenAsync(CancellationToken cancellationToken) in D:\a\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()
这是我所知道的:
- 应用程序在本地集群上安装和运行良好,但在 Azure 上却不行。
- 该应用程序由无状态 api 和有状态服务组成。有状态服务启动正常。大约 2 分钟后无状态进入失败状态。
我的问题是:如何或在哪里可以获得有关底层异常的更多信息?该服务在启动之前失败,因此我的日志记录尚不可用。我在门户网站的“诊断”中看不到任何内容。当无法在本地复制此类问题时,解决此类问题的最佳方法是什么?
如果您已启用事件提供程序 Microsoft-ServiceFabric
(Guid = "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8"
) 将事件发送到 Diagnostics,那么您应该能够看到一些与此相关的事件,class StatelessServiceInstanceAdapter
正在调用您的 WebHostBuilderHelper
时,当它遇到上述异常时,它应该发出类似 Got exception when opening communication listeners - XXX
的事件,这可能包含有关您的服务失败原因的更多信息。
您也可以简单地将您的 WebHostBuilderHelper.GetWebHost(...)
实现包装在 try/catch 中,并记录您的 ServiceEventSource
捕获的任何异常。服务试图打开监听器时出现异常,但从上面的原因还不清楚。