IIS默认日期时间格式 [英] IIS default datetime format

查看:450
本文介绍了IIS默认日期时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个WCF Web服务返回一些包含datetime值作为字符串的xml。该值首先从数据库中读出,然后使用.ToString()附加到xml字符串。

We have a WCF web service returns back some xml containing a datetime value as a string. The value is first read out from a database and then appended to an xml string using .ToString().

我们有许多Web服务器正在运行,但这个特定的是将datetime值转换为24小时值,我们需要它有12小时的值,但我无法弄清楚如何更改IIS默认日期格式。我尝试过更改区域设置,并查看Web服务的文化和ui文化值,这些值都设置为Invariant Language(Invariant Country)。

We have a number of web servers running but this particular one is converting the datetime value to a 24 hour value, we need it has a 12 hour value but I can't figure out how to change IIS default date format. I have tried changing the regional settings and have look at the culture and ui culture values of the web service which are both set to "Invariant Language (Invariant Country)".

我认为可能需要更改注册表。有谁知道如何更改Web服务的日期时间格式?

I think it might require a registry change. Does anyone know how to change the datetime format of a web service?

我们无法在此阶段更改代码,因此我唯一的选择是更新服务器本身。

We cannot change the code at this stage so my only choice is to update the server itself.

它在Windows Server 2008上运行。

Its running on windows server 2008.

谢谢

推荐答案

没关系的人我已经弄清楚了。要改变IIS网站/网站服务的日期时间区域设置,请执行以下操作:

Nevermind people I've figured it out. To change the datetime regional settings of an IIS website/webs ervice here is what you do:

首先进入IIS,然后单击要配置的网站/ Web服务。在右侧打开.Net全球化,将文化和文化改变为你想要的任何东西。

First go into IIS and click on the website/web service you want to configure. On the right hand side open up .Net Globalization and change the culture and ui culture to anything other than the one you want.

现在在控制面板中进入该区域和语言屏幕,并将日期时间格式更改为您想要的格式。然后在区域和语言屏幕的管理选项卡上单击复制设置按钮,并勾选欢迎屏幕和系统帐户框。在两个屏幕上单击确定以退出区域和语言。

Now in the control panel go into the region and language screen and change the datetime format to what you want it to be. Then on the administration tab of the region and language screen click the "Copy settings" button and tick the box "Welcome screen and system accounts". Click ok on both screens to exit region and language.

现在返回到IIS并将文化和ui文化更改回更改之前的状态。您的网站/网络服务现在应该提供正确的日期时间格式。

Now go back to IIS and change the culture and ui culture back to what it was before you change it. Your website/webservice should now be serving up the correct datetime format.

我认为这里的关键点是将区域和语言设置复制到所有系统用户。然后更改IIS文化设置使IIS拾取新设置。在区域和语言屏幕上进行更改后,您可能无法改变文化,只需重新启动网络服务器或计算机,但我还没试过。

I think the key point here is copying the region and language settings to all system users. then changing the IIS culture settings makes IIS pickup the new settings. You might get away with not changing the culture and simply restarting the webserver or the machine after making the changes in the region and language screen but i haven't tried this.

这篇关于IIS默认日期时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆