Fix ASP.NET Core port number on Service Fabric


If you create a stateless asp.net core api as service fabric service, the port number changes each time you restart the service fabric service. It’s quite annoying that your postman requests start failing because the port number has changed. To fix it, you have to override the resource, specifying the port number.

<ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="Web1Pkg" ServiceManifestVersion="1.0.0" />
    <ResourceOverrides>
      <Endpoints>
        <Endpoint Name="ServiceEndpoint" Port="8001"/>
      </Endpoints>
    </ResourceOverrides>
    <ConfigOverrides />
</ServiceManifestImport>