在服务结构中安装Java JRE作为启动任务



我添加了jre-8u121-windows-x64.exe并制作了install.cmd

start /B /WAIT jre-8u121-windows-x64.exe /s SPONSORS=0

在我的/PackageRoot/Code文件夹中

添加

<SetupEntryPoint>
  <ExeHost>
    <Program>install.cmd</Program>
    <WorkingFolder>CodePackage</WorkingFolder>
    <ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="2048"/>
  </ExeHost>
</SetupEntryPoint>

我的服务清单

在应用程序清单中添加了本金

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

和运行策略

<Policies>
  <RunAsPolicy CodePackageRef="Code" UserRef="Admin" EntryPointType="All" />
</Policies>

但由于某种原因未安装JRE。

使用上面的CMD版本时,它不会失败,我没有任何可供信息的日志文件。

我直接在程序中尝试了jre-8u121-windows-x64.exe /s,并且服务清单的参数元素也在事件日志中终止了一个问题。

SetupEntryPoint:ExeEntryPointDescription { Program = jre-8u121-windows-x64.exe, Arguments = /s /L d:/javainstall.log, WorkingFolder = Work, PeriodicIntervalInSeconds = 0 ConsoleRedirectionEnabled = true ConsoleRedirectionFileRetentionCount = 5 ConsoleRedirectionFileMaxSizeInKb = 2048 } terminated with exitcode 1. CodePackageIdentifier { ServicePackageId = S-Innovations.Elastic.ElasticApplicationType_App31:S-Innovations.Elastic.ElasticServicePkg, CodePackageName = Code }:131369814689037041

我在应用程序中以类似的方式运行了一个setup.cmd文件,并且使用 codebase 而不是CodePackage,它的工作正常。可能值得尝试。请参阅https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-deploy-existing-app

汉斯

最新更新