将web应用程序从vs2010转换为vs2013后,我遇到了问题 [英] I am getting issues after convert web app from vs2010 to vs2013

查看:61
本文介绍了将web应用程序从vs2010转换为vs2013后,我遇到了问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将日期保存到数据库时出现问题。


$ b $我正在按时间将其转换为按照国家/地区的时间将其保存并获得问题。



异常:



托管调试助手'DateTimeInvalidLocalFormat'在'C:\Program Files(x86)中检测到问题\ IIS Express \ iisexpress.exe'。



附加信息:UTC日期时间正在以仅对当地时间正确的格式转换为文本。

当使用'z'格式说明符调用DateTime.ToString时会发生这种情况,

将包括输出中的本地时区偏移。

在这种情况下,要么使用指定UTC时间的'Z'格式说明符,要么使用'o'格式字符串,

这是在文本中保留DateTime的推荐方法。

当传递由XmlConvert或DataSet序列化的DateTime时也会发生这种情况。

如果使用XmlConvert.ToString,则传入XmlDateTimeSerializationMode.RoundtripKind以正确序列化。

如果使用DataSet,请将DataColumn对象上的DateTimeMode设置为DataSetDateTime.Utc。

解决方案

它告诉您该怎么做。

Quote:

使用'z'格式说明符调用DateTime.ToString时会发生这种情况,

将包括输出中的本地时区偏移。

在这种情况下,要么使用指定UTC时间的'Z'格式说明符,要么使用'o'格式字符串,

这是在文本中保留DateTime的推荐方法。

更多内容 - dateTimeInvalidLocalFormat MDA [ ^ ]。


您好。在Visual Studio中运行或在IIS中部署时是否收到此错误。因为即使我遇到同样的问题,它在运行代码时工作正常,但一旦部署在IIS日期问题就在那里。我只是在IIS中设置了日期时间标准,后来它运行正常。


getting issue when save date into database.

i am getting utc time convert it into as per country time and save it and getting issues.

Exception :

Managed Debugging Assistant 'DateTimeInvalidLocalFormat' has detected a problem in 'C:\Program Files (x86)\IIS Express\iisexpress.exe'.

Additional information: A UTC DateTime is being converted to text in a format that is only correct for local times.
This can happen when calling DateTime.ToString using the 'z' format specifier,
which will include a local time zone offset in the output.
In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string,
which is the recommended way to persist a DateTime in text.
This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet.
If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly.
If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.

解决方案

It's telling you what to do.

Quote:

This can happen when calling DateTime.ToString using the 'z' format specifier,
which will include a local time zone offset in the output.
In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string,
which is the recommended way to persist a DateTime in text.

More at - dateTimeInvalidLocalFormat MDA[^].


Hi. Are you getting this error when running in visual studio or when deployed in IIS. Because even I faced same problem it was working fine when running through code but once deployed in IIS date problem was there. I just set the datetime standards in IIS and later it worked fine.


这篇关于将web应用程序从vs2010转换为vs2013后,我遇到了问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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