when localhost
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS Cache-Control: private Date: Tue, 18 Jun 2019 07:12:54 GMT Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 7 Content-Type: application/json; charset=utf-8 }
when publish
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS Cache-Control: private Date: Tue, 18 Jun 2019 04:38:35 GMT Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 3131 Content-Type: text/html }
Details
What I have tried:
double leaveacess = 0;
using (var client = new HttpClient())
{
var empdetail = new Leave_Details() { empid = items.empid.ToString(), fromdate = d1, todate = d2, tabt = "1", jdis = "0" };
client.BaseAddress = new Uri("http://vkalra.org/WCF_SERVICE/RestServiceImpl.svc/");
var postTask = client.PostAsJsonAsync<Leave_Details>("Leave_Calculation", empdetail);
var result = postTask.Result;
obj.error = result.ToString();
if (result.IsSuccessStatusCode)
{
var readTask = result.Content.ReadAsStringAsync();
string insertedStudent = readTask.Result.ToString();
string[] splitval = insertedStudent.Split(',');
leaveacess = Convert.ToDouble(splitval[0].ToString().Substring(1));
}
}