首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Service Fabric Explorer运行状况未知

Service Fabric Explorer运行状况未知
EN

Stack Overflow用户
提问于 2019-05-06 15:08:04
回答 1查看 237关注 0票数 0

我的分区中的节点一直在Health State = OK和Health State = unknown之间切换。有时节点会消失。

我尝试删除服务,应用程序,取消提供类型,然后重新部署,但我得到了同样的问题。

它是一个service Fabric有状态服务,并且在本地运行良好,我遇到的问题只出现在我的开发环境中。

我使用了5个节点。

ServiceManifest.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="Integration.Optical.ServicePkg"
                 Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <!-- This is the name of your ServiceType. 
         This name must match the string used in the RegisterServiceAsync call in Program.cs. -->
    <StatefulServiceType ServiceTypeName="Integration.Optical.ServiceType" />
  </ServiceTypes>

  <!-- Code package is your service executable. -->
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>Integration.Optical.Service.exe</Program>
        <WorkingFolder>CodePackage</WorkingFolder>
      </ExeHost>
    </EntryPoint>
    <EnvironmentVariables>
      <EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value=""/>
      <EnvironmentVariable Name="KEYVAULT_ENDPOINT" Value=""/>
    </EnvironmentVariables>
  </CodePackage>

  <!-- Config package is the contents of the Config directoy under PackageRoot that contains an 
       independently-updateable and versioned set of custom configuration settings for your service. -->
  <ConfigPackage Name="Config" Version="1.0.0" />

  <Resources>
    <Endpoints>
      <!-- This endpoint is used by the communication listener to obtain the port on which to 
           listen. Please note that if your service is partitioned, this port is shared with 
           replicas of different partitions that are placed in your code. -->
      <Endpoint Name="ServiceEndpoint" />

      <!-- This endpoint is used by the replicator for replicating the state of your service.
           This endpoint is configured through a ReplicatorSettings config section in the Settings.xml
           file under the ConfigPackage. -->
      <Endpoint Name="ReplicatorEndpoint" />
    </Endpoints>
  </Resources>
</ServiceManifest>

ApplicationManifest.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="Integration.OpticalType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="Integration.Optical.Service_ASPNETCORE_ENVIRONMENT" DefaultValue="" />
    <Parameter Name="Integration.Optical.Service_KEYVAULT_ENDPOINT" DefaultValue="" />
    <Parameter Name="Integration.Optical.Service_MinReplicaSetSize" DefaultValue="3" />
    <Parameter Name="Integration.Optical.Service_PartitionCount" DefaultValue="1" />
    <Parameter Name="Integration.Optical.Service_TargetReplicaSetSize" DefaultValue="3" />
  </Parameters>
  <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion 
       should match the Name and Version attributes of the ServiceManifest element defined in the 
       ServiceManifest.xml file. -->
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="Integration.Optical.ServicePkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
    <EnvironmentOverrides CodePackageRef="code">
      <EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="[Integration.Optical.Service_ASPNETCORE_ENVIRONMENT]" />
      <EnvironmentVariable Name="KEYVAULT_ENDPOINT" Value="[Integration.Optical.Service_KEYVAULT_ENDPOINT]" />
    </EnvironmentOverrides>
  </ServiceManifestImport>
  <DefaultServices>
    <!-- The section below creates instances of service types, when an instance of this 
         application type is created. You can also create one or more instances of service type using the 
         ServiceFabric PowerShell module.

         The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
    <Service Name="Integration.Optical.Service" ServicePackageActivationMode="ExclusiveProcess">
      <StatefulService ServiceTypeName="Integration.Optical.ServiceType" TargetReplicaSetSize="[Integration.Optical.Service_TargetReplicaSetSize]" MinReplicaSetSize="[Integration.Optical.Service_MinReplicaSetSize]">
        <UniformInt64Partition PartitionCount="[Integration.Optical.Service_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
      </StatefulService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

ApplicationParameters/Cloud.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/Integration.Optical" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="Integration.Optical.Service_ASPNETCORE_ENVIRONMENT" Value="" />
    <Parameter Name="Integration.Optical.Service_KEYVAULT_ENDPOINT" Value="" />
    <Parameter Name="Integration.Optical.Service_PartitionCount" Value="1" />
    <Parameter Name="Integration.Optical.Service_MinReplicaSetSize" Value="1" />
    <Parameter Name="Integration.Optical.Service_TargetReplicaSetSize" Value="1" />
  </Parameters>
</Application>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-09 14:27:26

不确定是哪部分修复了它。但这就是我所做的,现在它起作用了:

在ServiceManifest.xml中,我添加了HasPersistedState = true

代码语言:javascript
复制
<StatefulServiceType ServiceTypeName="Integration.Optical.ServiceType" HasPersistedState="true" />

我移动了应用程序配置代码

代码语言:javascript
复制
ServiceRuntime.RegisterServiceAsync...

Service.RunAsync()Program.Main()

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56000309

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档