Reputation: 1649
I've created a simple Stateful Actor and a Web API (self hosted) and deployed it to Azure. It has worked and I can browse the nodes in the Service Fabric Explorer.
Azure gives me a url but when I add /api/values to the end (which works fine locally) it downloads a file called values and I can't open it as it is a binary file.
I want to call the web api from a Xamarin app (ie normal Rest api call) but if I can't call it via a browser I'm a bit stuck.
Upvotes: 1
Views: 4099
Reputation: 41
I would comment this on Stephen's answer, but I lack sufficient reputation. To add a custom port to the Load Balancer after the service fabric cluster has been created you can (in the newer Azure portal):
Note if you have multiple ports to enable, they each need their own rule.
I do know the above worked in my 'hello world' sandbox project.
I'm climbing the service fabric learning curve myself so I can't comment with authority on the other settings.
Upvotes: 4
Reputation: 1606
Tutorials and technical resources around Azure Service Fabric Stateless Web API
tend to be slightly disjointed, given that the platform and resources are still quite immature.
This Stateless Web API tutorial, at the time of writing, is very effective.
As prerequisite to the tutorial:
Visual Studio
to the latest version (Extensions and Updates)Service Fabric SDK
to the latest version (Web Platform Installer)EndPoint Port
attribute (defined in ServiceManifest.xml
) when setting up your Azure Service Fabric Cluster Node Type
parametersFollowing these steps will successfully allow deployment to both local and remote clusters, and will expose your Web API endpoints for consumption.
Upvotes: 0
Reputation: 1649
Have discovered what was missing.
https://azure.microsoft.com/en-us/documentation/articles/service-fabric-cluster-creation-via-portal/
This link here walks through creating the Service Fabric app on Azure and in particular the field "Application input endpoints" needs to have the port you want to use. For the samples, they are mostly port 80 or 8081.
There is supposed to be a way to add these ports afterwards which I tried (and so did a Microsoft support engineer) and it did not seem to work. You are supposed to be able to add these ports to the Load Balancer associated with the Service Fabric App.
I recreated my Service Fabric app, exactly as I did before but this time filled in the ports I want to use in the Node Type section and now I can hit the webapi services I've deployed. This field can be left blank which is what I did first time round and was why I had issues.
Upvotes: 1
Reputation: 9050
Not really related to Service Fabric, it's just how you set up your HTTP response headers in Web API. Recommend tagging this with asp.net or asp.net-web-api for a more thorough answer.
Upvotes: 0