gpt4 book ai didi

c# - 使用 ServiceStack.Razor 在 ViewPage 上出现 System.TimeZoneNotFoundException

转载 作者:太空宇宙 更新时间:2023-11-03 13:36:53 33 4
gpt4 key购买 nike

我使用 Servicestack.Razor. 创建了一个 View 在 View 页面上,我尝试使用以下代码获取 session 。

var session = GetSession<AuthUserSession>().ToJson();

当我将此代码放在 View 页面上时,出现以下错误:

System.TimeZoneNotFoundException
Exception of type 'System.TimeZoneNotFoundException' was thrown.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.

StackTrace 如下:

Exception stack trace:
at System.TimeZoneInfo.get_Local () [0x00000] in <filename unknown>:0
at ServiceStack.Text.Common.DateTimeSerializer..cctor () [0x00000] in <filename unknown>:0

这是 Servicestack.Text 中的错误吗?我该如何解决这个问题?

注意:我在 Ubuntu 12.10 上使用 Mono 3.0.10

最佳答案

我在处理项目时遇到了同样的错误。就我而言,这是因为我没有正确导出的 TZ 环境变量。我必须将以下内容添加到我的 UI init shell 脚本中:

read TZ 2>/dev/null < /etc/timezone
export TZ

关于c# - 使用 ServiceStack.Razor 在 ViewPage 上出现 System.TimeZoneNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18395018/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com