我有两个Web服务器,WEB1和WEB2。功能:ASP.net在不同服务器上的时间渲染不同
public static string ToTimeAgoHTML(this DateTime date)
{
return "<time class=\"timeago\" datetime=\"" + date.ToString("o") + "\">" + date.FriendlyDate() + "</time>";
}
被调用一个值。这些呈现为:
WEB1
<time class="timeago" datetime="2017-04-03T15:12:04.9072263Z">3 Apr, 2017</time>
WEB2
<time class="timeago" datetime="2017-04-03T15:12:04.9072263">3 Apr, 2017</time>
注意WEB1呈现与z
末,而WEB2没有做到这一点。这导致Web2上的请求在过去1小时内显示。
在Windows中,两个网络服务器时区都设置为(UTC) Coordinated Universal Time
。
有谁知道这里会发生什么?
什么是文化? – mason
@Mason这两个网络服务器是相同的在IIS'不变语言(不变国家)' –
我会验证实际的线程。检查'Thread.CurrentThread.CurrentCulture'和'Thread.CurrentThread.CurrentUICulture' – mason