2
votes

I'm having trouble accessing my Web Api that has been deployed to my Service Fabric cluster. I've followed the new Stateless Web Api template and have added the http endpoint seen below. I also made modifications that to the OwinCommunication as depicted here.

<Resources>
   <Endpoints>
     <Endpoint Name="ServiceEndpoint" Type="Input" Protocol="http" Port="8080" />
   </Endpoints>
</Resources>

When creating my cluster I added a custom endpoint of 80 to my Node Type.

The client connection endpoint to my cluster is: mycluster.eastus.cloudapp.azure.com:19000

Also, I have a load balancing rule that maps port 80 to backend port 8080 over TCP. The probe associated is on port 80, and I have tried both protocols (http and tcp), but neither seem to work.

Locally, I can access an endpoint on my Web Api by calling http://localhost:8080/health/ping, and get back "pong". When I attempt to access it in service fabric cluster, a file is downloaded. The URL I use to access it in the cloud is http://mycluster.eastus.cloudapp.azure.com:19000/health/ping. I've tried other ports (19080, 80, 8080) but they either hang or give me a 400.

My questions regarding exposing a Web Api in a service fabric cluster are:

  1. Should the probe be http or tcp?
  2. Should the probe backend port be set to the web api port (e.g. 8080)?
  3. Is my URL/port correct for accessing my api?
  4. Why is a binary file being downloaded? This happens in all browsers, and the content being displayed in postman and fiddler.
2

2 Answers

2
votes

Found the answer to my question after a number of heuristics. If my Web Api endpoint is set to port 8080 then I need the following:

  1. Probe for port 8080 on TCP
  2. A load balancing rule with port 80 and backend port 8080
  3. Access the Web Api over the following URL: http://mycluster.eastus.cloudapp.azure.com/health/ping

As for #4, this is still a mystery.

0
votes
http://mycluster.eastus.cloudapp.azure.com:19000/health/ping

This is wrong.

It should be http://mycluster.eastus.cloudapp.azure.com:8080/health/ping

At least this what the documentation says. So it should work without touching the load balancer.