Search code examples
serviceazure-service-fabricstateless

Difference in ServiceManifest for owin hosted API controller vs regular stateless service


When you create owin hosted API controller in service fabric with vs 2015, the following line appears in the ServiceManifest.xml file (under Resources/Endpoints):

<Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="8726" />

But in case of regular stateless service, the following line appears in the related ServiceManifest.xml file:

<Endpoint Name="ServiceEndpoint" />

Since both are stateless services under the hood, why the difference in Endpoint definition? What does this signify? Also how would I call the 2nd service (from 1st service) over http transport?

Thanks.


Solution

  • A web API is normally used as a gateway to the application, so it requires a fixed port, to be mapped by the load balancer to an external port (in contrast to the default, a random port assigned by the Fabric).

    In addition, this ensures a correct HTTP endpoint registration in Windows, as described in the documentation:

    This step is important because the service host process runs under restricted credentials (Network Service on Windows). This means that your service won't have access to set up an HTTP endpoint on its own. By using the endpoint configuration, Service Fabric knows to set up the proper access control list (ACL) for the URL that the service will listen on. Service Fabric also provides a standard place to configure endpoints.