【问题标题】:Running dotnetcore Console application in Service Fabric Guest Executable在 Service Fabric 来宾可执行文件中运行 dotnetcore 控制台应用程序
【发布时间】:2019-04-26 14:38:33
【问题描述】:

我正在尝试在 ServiceFabric GuestExecutable 容器中运行 dotnetcore 控制台应用程序。当我将此 GuestExecutable 服务添加到我的 SF 应用程序时,我配置如下

  1. 代码包文件夹 -> ..repos\NewDllGuestSF\CoreConsole\bin\Debug\netcoreapp2.0

  2. 程序 -> CoreConsole.dll

  3. 工作文件夹 -> CodePackage

在这里,我知道我正在尝试将此 .dll 文件托管为我的 GuestExecutable 服务的可执行文件。这就是我想要做的,但不能以某种方式。当我对传统的 .NetFramework 应用程序和 .exe 可执行文件进行相同尝试时,我能够在 SF 集群上成功运行它。但我需要做的是使用 dotnetcore 应用程序,当然还有一个 dll 可执行文件。

到目前为止,我尝试过的是—— 我可以在构建 dotnetcore 控制台应用程序时生成 dll 和 exe,并在 GuestExecutable 中使用生成的 .exe 文件。但是在这里,我必须将我的控制台应用程序配置为将多个框架定位为“netcoreapp2.0;net461”,这是由于某些原因我无法做到的。

当我在 SF 集群中使用 dll 可执行文件运行我的 dotnetcore 控制台应用程序时,我遇到了以下错误

在这里,如果我们看到,GuestExecutable 服务保持健康状态,但应用程序没有。

谁能帮我解决这个问题,我想做的就是在 GuestExecutable SF 服务中托管一个 .dll 文件作为入口点。

【问题讨论】:

    标签: .net-core azure-service-fabric guest-executable


    【解决方案1】:

    据我了解,您需要在 ServiceManifest.xml 中配置 CodePackage 以使用外部可执行文件运行您的 .dll

    这是如何做到这一点的示例(请注意 IsExternalExecutable="true" 属性):

      <CodePackage Name="Code" Version="1.0.0">
        <EntryPoint>
          <ExeHost IsExternalExecutable="true">
            <!-- We are using dotnet cli to launch our Service.dll -->
            <Program>dotnet</Program>
            <Arguments>Service.dll</Arguments>
            <WorkingFolder>CodePackage</WorkingFolder>
          </ExeHost>
        </EntryPoint>
      </CodePackage>
    

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 2018-10-04
      • 2016-12-10
      • 2017-01-28
      • 2019-08-16
      • 2020-08-12
      • 2018-03-11
      • 2018-07-24
      • 2018-03-22
      • 2017-07-03
      相关资源
      最近更新 更多