8

I am serving an ASP.NET application from IIS 7 but we are experiencing some weird cookie issues. The code works fine in other environments so we are assuming this is specific to this server (related question).

We have been looking at the http headers returned and someone pointed out that the date http header is showing the 1st of Jan rather than today's date (so far it always shows that date regardless of what the current date is). The system clock is set correctly (and we can print out the current time/date via DateTime.Now correctly as well) so we can't work out why it's now working. Does anyone have any ideas? Is this a red-herring?

Thanks, James

  • Does getting a plain text file (i.e. no ASP.NET involvement) like a CSS file have the same Date header? – Richard Dec 30 '10 at 10:33
  • Am seeing a similar issue with IIS 8.5 on Server 2012r2. In our environment, the affected server is a VM in Azure that gets shutdown daily and restarted with incorrect date in the HTTP Response header. The date is a future date (appears to be nowtime + timezone offset). Local machine system time is correct. Server does a timesync event on restart. Once future time matches realtime, header time stays in sync with system time. – jafin Jul 21 '21 at 01:54

1 Answers1

12

This appears to be a known issue and frequently found on virtual machine due to time sync feature. You may need to restart HTTP service on IIS6 to recover the behavior. Please refer to the content below:

Problem Description

W3SVC logs show incorrect time - stuck on the same time 2007-11-04 04:56:06

REPRO STEPS

  1. Changed the system time to a future time (e.g. 11th May 2020)
  2. Browsed any site - verified the log file created in the new date/time
  3. Changed the system time to be correct (today's date and time)
  4. Now, browsed any website and saw that the time on the log files is now stuck on 11th May 2020's time

RESOLUTION

  • net stop http
  • net start w3svc

OR

  • net stop http
  • net start http
  • iisreset

You must restart the http service whenever you change the date in the server.

Verified in the code and confirmed that this is by design and you need to follow the above steps to make IIS logging the correct time.

I hope the information helps.

Source: http://www.eggheadcafe.com/software/aspnet/31164622/wrong-date-and-time-in-iis-log-file.aspx

David Murdoch
  • 492
  • 6
  • 19
cOzMaTiC
  • 148
  • 2
  • 5