端点在Service Fabric服务的ServiceManifest中配置什么? [英] What do the EndPoints configure in the ServiceManifest of an Service Fabric Service?

查看:86
本文介绍了端点在Service Fabric服务的ServiceManifest中配置什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Service Fabric Service项目,其中包含多种服务:Actor,有状态服务和无状态服务组合到一个ServiceManifest中.

We have a Service Fabric Service project with multiple services: Actors, Stateful services and Stateless services combined into one ServiceManifest.

两个有状态服务不起作用:调用了构造函数,创建了通讯侦听器(通过远程处理),但是调用了RunAsync方法.

Two stateful services did not work: the constructors were called, the communicationlisteners (through remoting) were created, but the RunAsync method was not called.

从ServiceManifest.xml中删除端点列表后,服务将再次开始工作.但是现在我们不知道为什么以及如何工作.有人可以解释吗?

After removing the endpoint listing from the ServiceManifest.xml the services started working again. But now we are left wondering why and how this works. Could someone explain?

为了说明这一点,相关部分是

To illustrate, the relevant section was

  <Resources>
    <Endpoints>
      <Endpoint Name="WebServiceEndpoint" Type="Input" Protocol="http" Port="80" />
      <Endpoint Name="StatelessServiceEndpoint1" Type="Input" Protocol="http" Port="10101" />
      <Endpoint Name="ActorServiceEndpoint1" />
      <Endpoint Name="ActorServiceReplicatorEndpoint1" />
      <Endpoint Name="ActorServiceEndpoint2" />
      <Endpoint Name="ActorServiceReplicatorEndpoint2" />
      <Endpoint Name="ActorServiceEndpoint3" />
      <Endpoint Name="ActorServiceReplicatorEndpoint3" />
      <Endpoint Name="ActorServiceEndpoint4" />
      <Endpoint Name="ActorServiceReplicatorEndpoint4" />
      <Endpoint Name="StatefulServiceEndpoint1" Type="Input" Protocol="http" />
      <Endpoint Name="StatefulServiceReplicatorEndpoint1" />
      <Endpoint Name="StatefulServiceEndpoint2" Type="Input" Protocol="http" />
      <Endpoint Name="StatefulServiceReplicatorEndpoint2" />
      <Endpoint Name="StatelessServiceEndPoint2" Type="Input" Protocol="http" />
    </Endpoints>
  </Resources>

将其更改为此

  <Resources>
    <Endpoints>
      <Endpoint Name="WebServiceEndpoint" Type="Input" Protocol="http" Port="80" />
      <Endpoint Name="StatelessServiceEndpoint1" Protocol="http" />
      <Endpoint Name="ActorServiceReplicatorEndpoint1" />
      <Endpoint Name="ActorServiceReplicatorEndpoint2" />
      <Endpoint Name="ActorServiceReplicatorEndpoint3" />
      <Endpoint Name="ActorServiceReplicatorEndpoint4" />
      <Endpoint Name="StatefulServiceReplicatorEndpoint1" />
      <Endpoint Name="StatefulServiceReplicatorEndpoint2" />
    </Endpoints>
  </Resources>

一切正常.但是为什么呢?

everything worked. But why?

编辑 完整的ServiceManifest是这样的:

EDIT The complete ServiceManifest is this:

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="Service" 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>
    <StatefulServiceType ServiceTypeName="ActorService1Type" />
    <StatefulServiceType ServiceTypeName="ActorService1Type" HasPersistedState="true" />
    <StatefulServiceType ServiceTypeName="ActorService3Type" />
    <StatefulServiceType ServiceTypeName="ActorService4Type" HasPersistedState="true" />
    <StatefulServiceType ServiceTypeName="StatefulService1Type" HasPersistedState="true" />
    <StatefulServiceType ServiceTypeName="StatefulService2Type" HasPersistedState="true" />
    <StatelessServiceType ServiceTypeName="StatelessService1Type" />
    <StatelessServiceType ServiceTypeName="StatelessService2Type" />
    <StatelessServiceType ServiceTypeName="WebServiceType" />
  </ServiceTypes>
  <CodePackage Name="Code" Version="1.0.0">
    <SetupEntryPoint>
      <ExeHost>
        <Program>Setup.exe</Program>
      </ExeHost>
    </SetupEntryPoint>
    <EntryPoint>
      <ExeHost>
        <Program>Service.exe</Program>
      </ExeHost>
    </EntryPoint>
  </CodePackage>
  <ConfigPackage Name="Config" Version="1.0.0" />
  <Resources>
    <Endpoints>
      <Endpoint Name="WebServiceEndpoint" Type="Input" Protocol="http" Port="80" />
      <Endpoint Name="StatelessServiceEndpoint1" Protocol="http" />
      <Endpoint Name="ActorServiceReplicatorEndpoint1" />
      <Endpoint Name="ActorServiceReplicatorEndpoint2" />
      <Endpoint Name="ActorServiceReplicatorEndpoint3" />
      <Endpoint Name="ActorServiceReplicatorEndpoint4" />
      <Endpoint Name="StatefulServiceReplicatorEndpoint1" />
      <Endpoint Name="StatefulServiceReplicatorEndpoint2" />
    </Endpoints>
  </Resources>
</ServiceManifest>

推荐答案

由于没有具体的错误或错误消息可以解决,因此很难知道在最初报告的情况下发生了什么,但是最终这通常是端口冲突共享您不想要或无法共享的端口,或者端口耗尽.

Hard to know what happened in your initial reported case since there's no specific error or error message to work off of, but usually this is port conflicts when you end up sharing ports that you don't really want to or which can't be shared, or port exhaustion.

服务清单中的端点资源主要用于以下情况:

The endpoint resource in your service manifest is mainly for times when:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆