运行 测试时,Azure Service Fabric 在本地集群中终止

Azure Service Fabric gets terminated in local cluster when running tests

所以我们正在使用 Azure Service Fabric,并且在尝试 运行 API 针对我的本地开发集群进行测试时出现奇怪的行为。

每次我开始测试时,应用程序都会终止,有时它会再次重新启动,但大多数情况下它只是保持终止状态(甚至从集群中删除)。

我猜它在某种程度上与我 运行 API 测试时它会 运行 和构建服务结构正在使用的东西有关,但由于结果不同取决于在某些东西上(也许是太阳?)感觉我要么遗漏了某些东西,要么遇到了服务结构的错误。

有人知道吗?将我视为菜鸟并假设我自己做错了什么(我至少正在这样做)。

更新

关于我们如何进行 运行 测试的问题:

  1. 启动 Visual Studio
  2. 的 2 个实例
  3. 在两者中打开相同的.sln
  4. 启动 Service Fabric 项目。
  5. 等到集群报告 OK。
  6. 运行 api 使用 Resharper 测试通过单元测试(服务总线测试和 REST 测试)进行测试 运行ner

现在我们得到诊断中附加的消息。

诊断:

事件 #1

{   
 "Timestamp": "2018-10-16T08:14:03.0590414+02:00",  
 "ProviderName": "Microsoft-ServiceFabric",   
 "Id": 23083,   
 "Message": ApplicationHostTerminated:   ApplicationId=fabric:/<MyService>,      ServiceName=fabric:/<MyService>,  ServicePackageName=<MyPackage>,      ServicePackageActivationId=8f36ac97-9271-4a49-94ce-dd296aebffa5,      IsExclusive=True,  CodePackageName=Code,  EntryPointType=Exe,      ExeName=MyExe,  ProcessId=24568, HostId=d2a820b5-5b4d-42af-ae87-350028a3fa72,  ExitCode=3221225786, UnexpectedTermination=False,  StartTime=10/16/2018 08:12:14. ",  
 "ProcessId": 22660,   
 "Level": "Informational",   
 "Keywords": "0x4000000000000001",   
 "EventName": "Hosting",   
 "ActivityID": null, 
 "RelatedActivityID": null,   
 "Payload": {
     "eventInstanceId": "\"07f15452-2f75-49e3-ad5d-d16ea49bdc8f\"",
     "applicationName": "MyAppName",
     "ServiceName": "fabric:/MyServiceName",
     "ServicePackageName": "MyPackageName",
     "ServicePackageActivationId": "8f36ac97-9271-4a49-94ce-dd296aebffa5",
     "IsExclusive": true,
     "CodePackageName": "Code",
     "EntryPointType": 1,
     "ExeName": "MyExe",
     "ProcessId": 24568,
     "HostId": "d2a820b5-5b4d-42af-ae87-350028a3fa72",
     "ExitCode": 3221225786,
     "UnexpectedTermination": false,
     "StartTime": "\"\/Date(1539670334917)\/\""   
 } 
}

事件#​​2

{   
 "Timestamp": "2018-10-16T08:14:02.3557708+02:00",  
 "ProviderName": "Microsoft-ServiceFabric",   
 "Id": 29625,   
 "Message": "Application deleted: Application = fabric:/MyApp, Application Type = MyServiceType ",   
 "ProcessId": 22660,   
 "Level": "Informational",  
 "Keywords": "0x4000000000000001",   
 "EventName": "CM",   
 "ActivityID": null,   
 "RelatedActivityID": null,   
 "Payload": {
     "eventInstanceId": "\"ca608cec-8d55-4606-a331-8ebfcfff8fa6\"",
     "applicationName": "fabric:/MyAppName",
     "applicationTypeName": "MyAppTypeName",
     "applicationTypeVersion": "1.0.0"   
 } 
}

我认为您可以体验为 .sfproj 设置的 Application Debug Mode 的副作用。

默认情况下 应用程序调试模式 设置为 Refresh Application(如果您使用 5 节点集群,它会自动更改为 Remove Application)或 Remove Application调试模式。这指示 Visual Studio 为每个调试会话重新创建应用程序并在会话结束时将其删除。

将其更改为 Keep Application 应该可以防止 Visual Studio 在调试会话期间重新创建应用程序。