将解决方案部署到 Service Fabric 群集时出现的问题

Issues when deploying solution to Service Fabric cluster

全部,

我似乎无法将在本地集群上完美运行的应用程序部署到 Azure 中的集群。

奇怪的是我以前可以部署这个应用,现在好像不行了。部署应用程序后,似乎我的无状态服务首先部署没有任何问题,但我的有状态服务和参与者似乎无法为副本找到合适的节点,因为我似乎收到以下警告(通过服务结构资源管理器, 选择应用程序时):

Unhealthy event: SourceId='System.PLB', Property='ServiceReplicaUnplacedHealth_Primary_8f41b6fb-3c6f-4916-9f85-27da0171ae6d', HealthState='Warning', ConsiderWarningAsError=false.
The Load Balancer was unable to find a placement for one or more of the Service's Replicas:
fabric:/Namespace/ActorService Primary Partition 8f41b6fb-3c6f-4916-9f85-27da0171ae6d could not be placed, possibly, due to the following constraints and properties:  
Placement Constraint: N/A
Depended Service: N/A

Constraint Elimination Sequence:
NodeBlockList eliminated 5 possible node(s) for placement -- 0/5 node(s) remain.

进一步调查,我也遇到了以下错误:

Error event: SourceId='System.Hosting', Property='CodePackageActivation:Code:EntryPoint'.
ServiceManifestName='ActorPkg', NodeName='_nt1vm_4',AggregatedHealthState='Error'.

在检查 blob 存储中的所有日志文件以及跟踪时,我还发现了以下日志语句:

2016-5-12 12:54:15.176,Warning,1516,2528,Hosting.ProcessActivationManager,Application service 66933b89-78e9-4590-8971-d0cad139d956 with processId 3240 for parent process 310a2a579b75d9847ba5a43d6b365d7c terminated with exit code 2148734720
2016-5-12 12:54:15.176,Warning,1516,2528,Hosting._Nodes_ProcessUnexpectedTermination@310a2a579b75d9847ba5a43d6b365d7c,ServiceHostProcess: Process.exe for ApplicationId 66933b89-78e9-4590-8971-d0cad139d956 terminated unexpectedly with exit code 2148734720 on node id 310a2a579b75d9847ba5a43d6b365d7c
2016-5-12 12:54:15.176,Informational,1516,2528,Hosting.ProcessActivationManager,Sending ApplicationService host down notification for apphost 66933b89-78e9-4590-8971-d0cad139d956, node 310a2a579b75d9847ba5a43d6b365d7c
2016-5-12 12:54:15.176,Warning,2888,2556,Hosting.ApplicationHostManager@310a2a579b75d9847ba5a43d6b365d7c:131075269508464788,Processing termination of activated Application Host: HostId=66933b89-78e9-4590-8971-d0cad139d956, ExitCode=2148734720
2016-5-12 12:54:15.176,Warning,2888,2556,IPC.ServerFailedToRemoveClient,527e532390 client 66933b89-78e9-4590-8971-d0cad139d956 not found
2016-5-12 12:54:15.176,Informational,2888,2556,Hosting.ApplicationHostManager@310a2a579b75d9847ba5a43d6b365d7c:131075269508464788,RemoveActivationTableEntry: ErrorCode=S_OK, HostId=66933b89-78e9-4590-8971-d0cad139d956
2016-5-12 12:54:15.176,Informational,1516,2528,Transport.Enqueue,adb77036b0 enqueue ef74d99d-1a29-4c34-b6d1-1f59542a42d8:1926 False  319B @ qsize 0/0B
2016-5-12 12:54:15.176,Informational,2864,2556,RA.HostingProcessClosedEvent_Hosting@310a2a579b75d9847ba5a43d6b365d7c:131075269508464788,RA on node 310a2a579b75d9847ba5a43d6b365d7c:131075269508464788 performing AppHost down processing for apphost: 66933b89-78e9-4590-8971-d0cad139d956/
2016-5-12 12:54:15.176,Informational,2864,2556,RA.MultipleFTWorkBegin_MultipleFT@310a2a579b75d9847ba5a43d6b365d7c:131075269508464788,Multiple FT Work Begin [Activity: AppHostClosed 66933b89-78e9-4590-8971-d0cad139d956]. FTs 36
2016-5-12 12:54:15.176,Informational,2888,2556,Hosting.HostingHealthManager@310a2a579b75d9847ba5a43d6b365d7c:131075269508464788,ServicePackage ReportHealth: HealthReport(fabric:/Namespace+ActorPkg+310a2a579b75d9847ba5a43d6b365d7c instance=131075312250519674 System.Hosting CodePackageActivation:Code:EntryPoint Error ttl=Infinite sn=131075312551846737 There was an error during CodePackage activation.The service host terminated with exit code:2148734720 removeWhenExpired=false 2016-05-12 12:54:15.184 priority NotAssigned)

如果有人对为什么我的应用程序不能再部署在云上有任何想法或建议,我们将不胜感激!

亲切的问候

我的 Service Fabric 部署也发生了同样的 2148734720 错误。我的 SF 应用程序的目标是 .net 4.6.1,但 SF 节点没有安装 .net 4。6.X。

在每个部署 SF 节点上安装 .net 4.6.2(并重新启动)后,此错误已修复。

为了回应 The Muffin Man 的评论,我已将我的答案从问题中删除并放在此处(并接受它作为解决方案):

在弄清楚如何产生额外的诊断信息之后。 (通过云资源管理器,导航到虚拟机规模集,然后 select 规模集。在我的例子中 'nt1vm' 并选择更新诊断...通过操作并打开所有日志记录)

我发现了这一行(在 WADWindowsEventLogsTable 中):

.NET Runtime version : 4.0.30319.34209 - This application could not be started.This application requires one of the following versions of the .NET Framework: .NETFramework,Version=v4.6.1Do you want to install this .NET Framework version now?

所以我正在降级我的应用程序以使用 .NET 4.5.2。

更新已解决:降级到 .NET 4.5.2 后,我的应用程序部署完美。感谢 post:Hosting console application in public service fabric cluster 让我试试这个。

如果您将 .Net 核心与 Windows 的非 en-US 版本一起使用,您可能会在 2.0.3 之前的框架版本中遇到此问题: https://github.com/Azure/service-fabric-issues/issues/643

正如 GitHub 讨论所说,解决方案是升级到新版本的 .Net Core。但是,即使在这样做之后,如果没有选择新版本的框架,您可能仍然会遇到问题。

您可以通过在 .csproj 中明确指定版本来解决此问题:

 <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
    <IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
 </PropertyGroup>