https和Service Fabric的问题

时间:2018-08-20 10:28:26

标签: https azure-service-fabric

在尝试按照this指南在ServiceFabric后端上实现https时,我发现本地群集抛出以下错误:

  

激活CodePackage时出错。服务主机   以退出代码终止:1

有时会弹出以下内容:

  

结构:/Dev.Project/Api尚未准备好,1   剩余的分区。 =>花费了太长时间,应用程序   还没准备好。

在诊断事件中,我发现了

{
  "Timestamp": "2018-08-20T12:01:21.6423999+02:00",
  "ProviderName": "Microsoft-ServiceFabric",
  "Id": 23083,
  "Message": "ApplicationHostTerminated:   ApplicationId=fabric:/Dev.Project,  ServiceName=fabric:/Dev.Project/Api,  ServicePackageName=ApiPkg,  ServicePackageActivationId=1d4426dc-3d5e-41ea-aa44-6e9794ff7c69,  IsExclusive=True,  CodePackageName=Code,  EntryPointType=Exe,  ExeName=Setup.bat,  ProcessId=29024,  HostId=77c22be7-b993-46c6-92dd-7c7ed0c8af1c,  ExitCode=1,  UnexpectedTermination=True,  StartTime=12:01:21.568939 (151,099.982 MSec). ",
  "ProcessId": 25768,
  "Level": "Informational",
  "Keywords": "0x4000000000000001",
  "EventName": "Hosting",
  "ActivityID": null,
  "RelatedActivityID": null,
  "Payload": {
    "eventInstanceId": "6dbdc967-85ed-429a-ae6a-939aeeea1e3f",
    "applicationName": "fabric:/Dev.Project",
    "ServiceName": "fabric:/Dev.Project/Api",
    "ServicePackageName": "ApiPkg",
    "ServicePackageActivationId": "1d4426dc-3d5e-41ea-aa44-6e9794ff7c69",
    "IsExclusive": true,
    "CodePackageName": "Code",
    "EntryPointType": 1,
    "ExeName": "Setup.bat",
    "ProcessId": 29024,
    "HostId": "77c22be7-b993-46c6-92dd-7c7ed0c8af1c",
    "ExitCode": 1,
    "UnexpectedTermination": true,
    "StartTime": "2018-08-20T12:01:21.5689395+02:00"
  }
}

该ID是我的Api服务的ID。它可能与Setup.bat没有正确执行有关,或者在运行它时引发了错误,但是我不知道该怎么办。如指南中所述,我添加了

<Principals>
  <Users>
    <User Name="SetupAdminUser">
      <MemberOf>
        <SystemGroup Name="Administrators" />
      </MemberOf>
    </User>
  </Users>
</Principals>

部分,并将RunAsPolicy也添加到服务中

<ServiceManifestImport>
  <ServiceManifestRef ServiceManifestName="ApiPkg" ServiceManifestVersion="1.0.0" />
  <ConfigOverrides>
    <ConfigOverride Name="Config">
      ...
    </ConfigOverride>
  </ConfigOverrides>
  <EnvironmentOverrides CodePackageRef="Code">
    ...
  </EnvironmentOverrides>
  <Policies>
    <RunAsPolicy CodePackageRef="Code" UserRef="SetupAdminUser" EntryPointType="Setup" />
  </Policies>
</ServiceManifestImport>

我到处搜索,但是找不到问题所在。欢迎任何输入! 预先感谢!

1 个答案:

答案 0 :(得分:0)

这对我有用。 我添加了LocalSystem而不是Admin用户。

 <Policies>
  <RunAsPolicy CodePackageRef="Code" UserRef="SetupLocalSystem" EntryPointType="Setup" />
</Policies>

 <Principals>
<Users>
  <User Name="SetupLocalSystem" AccountType="LocalSystem" />
</Users>

还要注意SetCertAccess.ps1文件中的DNS名称,它应该与群集名称相同。

$subject="your cluster DNS name"