I have a problem calling a webHttpBinding WCF end point using HttpClient and the BaseAddress property.
HttpClient
I created a HttpClient instance specifying the BaseAddress property as a local host endpoint.
GetAsync Call
I then call the GetAsync method passing in the additional Uri inforamtion.
HttpResponseMessage response = await client.GetAsync(string.Format("/Layouts/{0}", machineInformation.LocalMachineName()));
Service endpoint
[OperationContract]
[WebGet(UriTemplate = "/Layouts/{machineAssetName}", ResponseFormat = WebMessageFormat.Json)]
List<LayoutsDto> GetLayouts(string machineAssetName);
Problem
The problem I am having is that the is that /AndonService.svc
part of the BaseAddress is being truncated so the resultant call goes to https://localhost:44302/Layouts/1100-00277
rather that https://localhost:44302/AndonService.svc/Layouts/1100-00277
resulting in a 404 Not Found.
Is there a reason the BaseAddress is being truncated in the GetAsync call? How do I get around this?