azureasp.net-web-apiazure-service-fabricservice-fabric-stateful

Error when calling Web API with self-hosted Azure Service Fabric


I am using a new Azure Service Fabric project. The project contains 2 statefull services as shown in the below image:

Solution tree in Visual Studio

When I run the application, the explorer is shown successfully as below:

Service Fabric Explorer

But when I try to hit my API, http://localhost:19080/api/values, I get the below Invalid argument error. It does not hit the controller:

Invalid argument error message

Kindly advise how to solve this error.


Solution

  • As LoekD mentioned, port 19080 is used by the Service Fabric explorer. You can find the actual port of your application in ServiceManifest.xml of API project. There should be the section Resources with Endpoints like:

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