我将数据(模型)发布到api服务,发送时间正确,但接收api减去1小时,为什么会发生这种情况,我该如何解决?
准备发送请求:
[HttpPost]
public JsonResult RequestBooking(string model)
{
var e = new BookingRequest();
var objJavascript = new JavaScriptSerializer();
e = objJavascript.Deserialize<BookingRequest>(model);
//e.AppointmentDate = 21/09/2016 13:00:00
string addressRoute = "api.domain.com/Booking/Post";
using (var booking = new HttpClient())
{
booking.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = booking.PostAsync(addressRoute, new StringContent(new JavaScriptSerializer().Serialize(e), Encoding.UTF8, "application/json")).Result;
return Json(response, JsonRequestBehavior.AllowGet);
}
}
收到:
public HttpResponseMessage PostRequest(DomainObjects.BookingRequest request)
{
//request.Appointment = 21/09/2016 12:00:00 <----
}