通过 SQL 服务器身份验证安装 Sensenet 服务包时出现 UTC 偏移错误
UTC offset error when installing the Sensenet Service package via SQL Server Authentication
最近几天,我一直在尝试通过SQL 服务器身份验证安装sensenet 服务包。以前,我能够通过 Windows Integrated Security 成功安装软件包,但选择了 SQL 服务器身份验证。 Sensenet 截至目前仅支持 MS SQL 数据库,所以这就是我所使用的。我在 AWS RDS 中创建了一个免费层 MS SQL 数据库,没有任何偏好的时区、可用区(us-east-1 但没有指定我是否想要 1a、1b、1c 等)并且所有内容都设置为默认值。从文档中读取,它说默认情况下它将我的时区设置为 UTC,在我的控制台中,为我的数据库实例创建的时区是 GMT-400 。我本地机器的时区设置为东部标准时间 (UTC-05:00)。现在这就是问题发生的地方。
按照安装服务包和构建解决方案的步骤进行操作后,我转到 SnAdmin.exe 所在的 bin 文件夹,以管理员模式打开命令提示符并键入以下内容:
\snadmin install-services dataSource:some-amazon-endpoint.com initialCatalog:someDatabase
username:usernameToLoginInServer password:passwordToLoginInServer dbusername:nameOfUserInSomeDatabase
dbpassword:passwordOfUserInSomeDatabase
要激活 SQL 服务器身份验证,需要所有这些变量。这是我进入执行阶段2后得到的stacktrace。
ApplicationException: Phase terminated with error: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 165
at SenseNet.Packaging.PackageManager.Execute(String packagePath, String targetPath, Int32 currentPhase, String[] parameters, TextWriter console) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 71
at SenseNet.Tools.SnAdmin.SnAdminRuntime.ExecutePhase(String packagePath, String targetDirectory, Int32 phase, String[] parameters, String logFilePath, Boolean help, Boolean schema) in E:\BuildAgent\_work\s\src\Tools\SnAdminRuntime\SnAdminRuntime.cs:line 191
---- Inner Exception:
ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at SenseNet.ContentRepository.Storage.Caching.SnMemoryCache.Insert(String key, Object value, CacheDependency dependencies) in E:\BuildAgent\_work\s\src\Storage\Caching\SnMemoryCache.cs:line 49
at SenseNet.ContentRepository.Storage.DataBackingStore.CacheNodeHead(NodeHead head, String idKey, String pathKey) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 136
at SenseNet.ContentRepository.Storage.DataBackingStore.GetNodeHead(Int32 nodeId) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 65
at SenseNet.ContentRepository.User.get_Administrator() in E:\BuildAgent\_work\s\src\ContentRepository\User.cs:line 47
at SenseNet.ContentRepository.Security.DesktopAccessProvider.get_CurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 36
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.Security.DesktopAccessProvider.GetCurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 52
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 141
at SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 107
at SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\Repository.cs:line 55
at SenseNet.Packaging.Steps.StartRepository.Execute(ExecutionContext context) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\Steps\StartRepository.cs:line 55
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 112
===============================================================================
SnAdmin stopped with error.
快速解决方法
将我机器中的本地时区更改为 UTC 消除了错误。这并不理想,因为我希望它使用我的机器自动应用的正确时区。我只是对为什么当我的时区是 EST 时它失败感到困惑,因为我不确定这是否与 sensenet 或 AWS 本身有关。任何帮助将不胜感激。
我在网上广泛搜索了与此问题相关的任何信息。尽管我以稍微不同的方式安装 sensenet,但我认为这可能会有所帮助。我在 mvc 项目中使用 nuget sensenet.services.install 安装 sensenet 7.4。
我在安装过程中遇到了类似的问题。
15:41:24.9333 startIndexingEngine: False
15:41:24.9333 indexPath: C:\Users\username\Source\repos\demo\demo\App_Data\LocalIndex
15:41:28.7483 ApplicationException: Phase terminated with error: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 165
at SenseNet.Packaging.PackageManager.Execute(String packagePath, String targetPath, Int32 currentPhase, String[] parameters, TextWriter console) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 71
at SenseNet.Tools.SnAdmin.SnAdminRuntime.ExecutePhase(String packagePath, String targetDirectory, Int32 phase, String[] parameters, String logFilePath, Boolean help, Boolean schema) in E:\BuildAgent\_work\s\src\Tools\SnAdminRuntime\SnAdminRuntime.cs:line 191
---- Inner Exception:
ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at SenseNet.ContentRepository.Storage.Caching.SnMemoryCache.Insert(String key, Object value, CacheDependency dependencies) in E:\BuildAgent\_work\s\src\Storage\Caching\SnMemoryCache.cs:line 49
at SenseNet.ContentRepository.Storage.DataBackingStore.CacheNodeHead(NodeHead head, String idKey, String pathKey) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 136
at SenseNet.ContentRepository.Storage.DataBackingStore.GetNodeHead(Int32 nodeId) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 65
at SenseNet.ContentRepository.User.get_Administrator() in E:\BuildAgent\_work\s\src\ContentRepository\User.cs:line 47
at SenseNet.ContentRepository.Security.DesktopAccessProvider.get_CurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 36
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.Security.DesktopAccessProvider.GetCurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 52
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 141
at SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 107
at SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\Repository.cs:line 55
at SenseNet.Packaging.Steps.StartRepository.Execute(ExecutionContext context) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\Steps\StartRepository.cs:line 55
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 112
15:41:28.9122 ===============================================================================
15:41:28.9132 SnAdmin stopped with error.
基于 "Luis Averhoff's" 解决方法,我发现如果您使用此方法进行安装;您可以通过将本地时钟设置为 utc - 1(布达佩斯时间)
来完成安装
我正在寻找不需要此变通方法的解决方案,但目前这将使您能够安装 sensenet。
我无法发表评论,所以我在这里发布。我必须将时间设置为在没有偏移的情况下直接使用 UTC。差异可能与 DST 和您所在的位置有关。无论如何,我认为这可能会对某人有所帮助。希望开发人员知道这一点(我会尝试与他们联系以确保)。
编辑:已在 github 上发布问题。
我们认为问题在于我们在将对象插入缓存时使用了不正确的 DateTime 最大值。修复已在 version 7.4.1 中发布,我们在其中使用 DateTimeOffset 最大值。
最近几天,我一直在尝试通过SQL 服务器身份验证安装sensenet 服务包。以前,我能够通过 Windows Integrated Security 成功安装软件包,但选择了 SQL 服务器身份验证。 Sensenet 截至目前仅支持 MS SQL 数据库,所以这就是我所使用的。我在 AWS RDS 中创建了一个免费层 MS SQL 数据库,没有任何偏好的时区、可用区(us-east-1 但没有指定我是否想要 1a、1b、1c 等)并且所有内容都设置为默认值。从文档中读取,它说默认情况下它将我的时区设置为 UTC,在我的控制台中,为我的数据库实例创建的时区是 GMT-400 。我本地机器的时区设置为东部标准时间 (UTC-05:00)。现在这就是问题发生的地方。
按照安装服务包和构建解决方案的步骤进行操作后,我转到 SnAdmin.exe 所在的 bin 文件夹,以管理员模式打开命令提示符并键入以下内容:
\snadmin install-services dataSource:some-amazon-endpoint.com initialCatalog:someDatabase
username:usernameToLoginInServer password:passwordToLoginInServer dbusername:nameOfUserInSomeDatabase
dbpassword:passwordOfUserInSomeDatabase
要激活 SQL 服务器身份验证,需要所有这些变量。这是我进入执行阶段2后得到的stacktrace。
ApplicationException: Phase terminated with error: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 165
at SenseNet.Packaging.PackageManager.Execute(String packagePath, String targetPath, Int32 currentPhase, String[] parameters, TextWriter console) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 71
at SenseNet.Tools.SnAdmin.SnAdminRuntime.ExecutePhase(String packagePath, String targetDirectory, Int32 phase, String[] parameters, String logFilePath, Boolean help, Boolean schema) in E:\BuildAgent\_work\s\src\Tools\SnAdminRuntime\SnAdminRuntime.cs:line 191
---- Inner Exception:
ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at SenseNet.ContentRepository.Storage.Caching.SnMemoryCache.Insert(String key, Object value, CacheDependency dependencies) in E:\BuildAgent\_work\s\src\Storage\Caching\SnMemoryCache.cs:line 49
at SenseNet.ContentRepository.Storage.DataBackingStore.CacheNodeHead(NodeHead head, String idKey, String pathKey) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 136
at SenseNet.ContentRepository.Storage.DataBackingStore.GetNodeHead(Int32 nodeId) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 65
at SenseNet.ContentRepository.User.get_Administrator() in E:\BuildAgent\_work\s\src\ContentRepository\User.cs:line 47
at SenseNet.ContentRepository.Security.DesktopAccessProvider.get_CurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 36
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.Security.DesktopAccessProvider.GetCurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 52
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 141
at SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 107
at SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\Repository.cs:line 55
at SenseNet.Packaging.Steps.StartRepository.Execute(ExecutionContext context) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\Steps\StartRepository.cs:line 55
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 112
===============================================================================
SnAdmin stopped with error.
快速解决方法
将我机器中的本地时区更改为 UTC 消除了错误。这并不理想,因为我希望它使用我的机器自动应用的正确时区。我只是对为什么当我的时区是 EST 时它失败感到困惑,因为我不确定这是否与 sensenet 或 AWS 本身有关。任何帮助将不胜感激。
我在网上广泛搜索了与此问题相关的任何信息。尽管我以稍微不同的方式安装 sensenet,但我认为这可能会有所帮助。我在 mvc 项目中使用 nuget sensenet.services.install 安装 sensenet 7.4。 我在安装过程中遇到了类似的问题。
15:41:24.9333 startIndexingEngine: False
15:41:24.9333 indexPath: C:\Users\username\Source\repos\demo\demo\App_Data\LocalIndex
15:41:28.7483 ApplicationException: Phase terminated with error: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 165
at SenseNet.Packaging.PackageManager.Execute(String packagePath, String targetPath, Int32 currentPhase, String[] parameters, TextWriter console) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 71
at SenseNet.Tools.SnAdmin.SnAdminRuntime.ExecutePhase(String packagePath, String targetDirectory, Int32 phase, String[] parameters, String logFilePath, Boolean help, Boolean schema) in E:\BuildAgent\_work\s\src\Tools\SnAdminRuntime\SnAdminRuntime.cs:line 191
---- Inner Exception:
ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at SenseNet.ContentRepository.Storage.Caching.SnMemoryCache.Insert(String key, Object value, CacheDependency dependencies) in E:\BuildAgent\_work\s\src\Storage\Caching\SnMemoryCache.cs:line 49
at SenseNet.ContentRepository.Storage.DataBackingStore.CacheNodeHead(NodeHead head, String idKey, String pathKey) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 136
at SenseNet.ContentRepository.Storage.DataBackingStore.GetNodeHead(Int32 nodeId) in E:\BuildAgent\_work\s\src\Storage\DataBackingStore.cs:line 65
at SenseNet.ContentRepository.User.get_Administrator() in E:\BuildAgent\_work\s\src\ContentRepository\User.cs:line 47
at SenseNet.ContentRepository.Security.DesktopAccessProvider.get_CurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 36
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.Security.DesktopAccessProvider.GetCurrentUser() in E:\BuildAgent\_work\s\src\ContentRepository\Security\DesktopAccessProvider.cs:line 52
at SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount() in E:\BuildAgent\_work\s\src\Storage\Security\AccessProvider.cs:line 45
at SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 141
at SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\RepositoryInstance.cs:line 107
at SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\s\src\ContentRepository\Repository.cs:line 55
at SenseNet.Packaging.Steps.StartRepository.Execute(ExecutionContext context) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\Steps\StartRepository.cs:line 55
at SenseNet.Packaging.PackageManager.ExecuteCurrentPhase(Manifest manifest, ExecutionContext executionContext) in E:\BuildAgent\_work\s\src\ContentRepository\Packaging\PackageManager.cs:line 112
15:41:28.9122 ===============================================================================
15:41:28.9132 SnAdmin stopped with error.
基于 "Luis Averhoff's" 解决方法,我发现如果您使用此方法进行安装;您可以通过将本地时钟设置为 utc - 1(布达佩斯时间)
来完成安装我正在寻找不需要此变通方法的解决方案,但目前这将使您能够安装 sensenet。
我无法发表评论,所以我在这里发布。我必须将时间设置为在没有偏移的情况下直接使用 UTC。差异可能与 DST 和您所在的位置有关。无论如何,我认为这可能会对某人有所帮助。希望开发人员知道这一点(我会尝试与他们联系以确保)。
编辑:已在 github 上发布问题。
我们认为问题在于我们在将对象插入缓存时使用了不正确的 DateTime 最大值。修复已在 version 7.4.1 中发布,我们在其中使用 DateTimeOffset 最大值。