Please find my client code
HttpContent content = new StringContent(data.ToString(), Encoding.UTF8, "application/json"); HttpClient client = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true }); content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json"); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); string serverNameOne= "http://servername/wespapi/api/task/GetGanttTasks"; string ServerName= "http://servername/api/task/GetGanttTasks"; var response = client.PostAsync(durl1,content).Result; return response.Content.ReadAsStringAsync().Result;
Quote:This is my client code to call web api. All other methods are working fine with serverNameOne address. only here i have a problem. when i use ServerName without the sub root it works fine. Exception details
InnerException {"Error while copying content to a stream."} System.Exception {System.Net.Http.HttpRequestException}
InnerException {"The request was aborted: The connection was closed unexpectedly."} System.Exception {System.Net.WebException}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)