Hi All,
I have a question in WEB Api consuming in MVC is throwing an error, like "Time outs are not supported on this stream"
- public async Task<ActionResult> InsertVendorDetails(Vendor V)
- {
- Session["UserId"] = "1001";
- if (V.FirstName != null && V.LastName != null && V.MobileNo != null && V.UserName != null && V.Address != null && V.IDProof != null && V.EmailId != null && V.Password != null)
- {
- HttpClient client = new HttpClient();
- client.BaseAddress = new Uri(Baseurl);
-
- client.DefaultRequestHeaders.Accept.Clear();
- V.CreatedBy = Session["UserId"].ToString();
-
- HttpResponseMessage response = await client.PostAsJsonAsync("NewVendorRegistration", V);
- if (response.IsSuccessStatusCode == true)
- {
- var vendorresponse = response.Content.ReadAsStringAsync().Result;
- var StatusCode = JObject.Parse(vendorresponse)["StatusCode"].ToString();
- if (StatusCode == "1")
- {
- return RedirectToAction("GetVendor", "SmartParkingApplication");
- }
-
- else
- {
- var Response = JObject.Parse(vendorresponse)["Response"].ToString();
- ModelState.AddModelError(string.Empty, Response.ToString());
- }
- }
- else
- {
- ModelState.AddModelError(string.Empty, "Server Error.Please contact administrator.");
- }
- return View();
- }
- return View();
- }
At Line no : 12
while running in postman it's consuming correctly but in mvc it's not running.
If there's a solution please let me know it as soon as possible.