Hello, guys
I created and deployed a sample web api services into IIS on remote server according this tutorial http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations
After deployed completely, I want to write a client to call this api accrording http://www.asp.net/web-api/overview/web-api-clients/calling-a-web-api-from-a-net-client
In code snap, I don't know how to know the port number
namespace ProductStoreClient { using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; class Program { static void Main(string[] args) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:9000/"); //How to know "9000" in my environment? // Add an Accept header for JSON format. client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); } } }
Because I deployed API to a remote server than local host machine, I modified "http://localhost:xxxx" to "http://server01:xxxx". How to know the "xxxx"?
Thanks.