The following forum(s) have migrated to Microsoft Q&A (Preview): Azure Service Fabric!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Rest Service on service fabric cluster RRS feed

  • Question

  • Hi 

    I am trying to deploy a rest service to the service fabric cluster. It works fine when I deploy it to a local cluster using Visual studio F5 . However, i am unsure how to access it when deployed it to  a remote azure cluster. I am wondering if I am using the wrong url

    http://localhost:21000/api/values     - this works

    http://gagupcluster.australiaeast.cloudapp.azure.com:21000/api/values  - this does not work. gagupcluster is the service cluster.

    My application and the service manifest files are below

    <?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="WebAPIServiceFabricType" ApplicationTypeVersion="2.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
       <Parameters>
          <Parameter Name="MyWebApi_InstanceCount" DefaultValue="-1" />
       </Parameters>
       <ServiceManifestImport>
          <ServiceManifestRef ServiceManifestName="MyWebApiPkg" ServiceManifestVersion="2.0.0" />
          <ConfigOverrides />
       </ServiceManifestImport>
       <DefaultServices>
          <Service Name="MyWebApi">
             <StatelessService ServiceTypeName="MyWebApiType" InstanceCount="[MyWebApi_InstanceCount]">
                <SingletonPartition />
             </StatelessService>
          </Service>
       </DefaultServices>
    </ApplicationManifest>


    <?xml version="1.0" encoding="utf-8"?>
    <ServiceManifest Name="MyWebApiPkg"
                     Version="2.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 RegisterServiceType call in Program.cs. -->
        <StatelessServiceType ServiceTypeName="MyWebApiType" />
      </ServiceTypes>

      <!-- Code package is your service executable. -->
      <CodePackage Name="Code" Version="2.0.0">
        <EntryPoint>
          <ExeHost>
            <Program>MyWebApi.exe</Program>
          </ExeHost>
        </EntryPoint>
      </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="2.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 Protocol="http" Name="ServiceEndpoint" Type="Input" Port="21000" />
        </Endpoints>
      </Resources>
    </ServiceManifest>

    any help will be greatly appreciated.

    Gaurav


    • Edited by Itsgoff Wednesday, April 20, 2016 4:07 PM
    Wednesday, April 20, 2016 4:06 PM

Answers

  • Yes, you need to open the port(s) for you application, in this case 21000 on the Azure load balancer to allow the traffic through to your app. You can create these after your cluster has been create by creating new LB rules and LB probes. If you look at the example ones in the cluster (assuming that you specified at least one app port on cluster creation) and read the guidance here

    https://azure.microsoft.com/en-us/documentation/articles/load-balancer-get-started-internet-arm-ps/ hopefully you can see how this networking works.

    Mark


    Lead Program Manager, Microsoft

    • Marked as answer by Itsgoff Thursday, July 28, 2016 9:53 AM
    Sunday, April 24, 2016 5:15 AM
    Owner

All replies

  • When creating your cluster you need to allow any ports you want open explicitly, if you've not done that for port 21000 then that will be your problem.

    At the last time I checked it wasn't possible to open ports after creation, so you'll have to recreate your cluster to add those ports, that may have changed though.

    Thursday, April 21, 2016 1:46 PM
  • Yes, you need to open the port(s) for you application, in this case 21000 on the Azure load balancer to allow the traffic through to your app. You can create these after your cluster has been create by creating new LB rules and LB probes. If you look at the example ones in the cluster (assuming that you specified at least one app port on cluster creation) and read the guidance here

    https://azure.microsoft.com/en-us/documentation/articles/load-balancer-get-started-internet-arm-ps/ hopefully you can see how this networking works.

    Mark


    Lead Program Manager, Microsoft

    • Marked as answer by Itsgoff Thursday, July 28, 2016 9:53 AM
    Sunday, April 24, 2016 5:15 AM
    Owner