从字符串“31/03/2012”的转换输入“日期”无效
我的网络应用程序在 asp vb.net 编辑器中完美运行。但是当我通过 IIS7 运行我的 Web 应用程序时,我收到此错误。我在配置 IIS7 时缺少什么?有人可以提出建议吗?
提前致谢
My web app is running perfectly in asp vb.net editor. But when i run my web app through IIS7 then i get this error. What am i missing in configuring IIS7? Is there anyone who can suggest something?
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您确定日期始终采用该格式,则可以使用 ParseExact 代替:
If you are sure that the date is always in exactly that format, then you can use ParseExact instead:
您还可以使用 CDate 函数来解析日期。
与 DateTime 解析函数相比,使用此函数的优点是您可以向其提供任何可接受的日期字符串格式,它会对其进行转换。如果无法解析日期,它将抛出错误。
You can also use the CDate function to parse the date.
The advantage of using this function over the DateTime parsing functions is that you can feed it any acceptable format of date string and it will convert it. It will throw an error if it can't parse the date.
因为您的 IIS7 配置为英语,而该日期可能是意大利语或类似的语言。您必须告诉
Date.Parse
要使用哪种区域性。或者
您可以更改 IIS7 中的文化
这里有 说明
例如,如果您使用 UI
或者您可以在
web.config
中设置应用程序的文化Because your IIS7 is configured for the English Language and that date is probably Italian or something similar. You'll have to tell to the
Date.Parse
which culture to use.Something like
Or you can change the culture in your IIS7
Here there are the instructions
for example if you use the UI
Or you could set the culture of your app in the
web.config