【发布时间】:2016-04-19 04:50:32
【问题描述】:
我正在编写一个位于 System Center Orchestrator 设置前面的小型 Web 界面。它应该按运行手册获取一些数据 - 这部分基本上不重要。
该代码正在尝试使用来自https://msdn.microsoft.com/en-us/library/hh921685.aspx 的示例代码(并根据我的要求)来启动一个运行手册作业以获取一些数据
我更改的唯一行是对我自己的 Orchestrator、Runbook GUID 和 Runbook 参数的引用。
这行抛出了标题中的异常:
context.SaveChanges();
此堆栈跟踪显示错误似乎源自 OData 领域的某处,这远远超出了我的代码:
[ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset]
System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset) +14215620
System.DateTimeOffset..ctor(DateTime dateTime) +56
Microsoft.Data.OData.Atom.EpmSyndicationWriter.CreateDateTimeStringValue(Object propertyValue, ODataWriterBehavior writerBehavior) +144
Microsoft.Data.OData.Atom.EpmSyndicationWriter.WriteEntryEpm(EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference entityType) +652
Microsoft.Data.OData.Atom.EpmSyndicationWriter.WriteEntryEpm(EpmTargetTree epmTargetTree, EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference type, ODataAtomOutputContext atomOutputContext) +80
Microsoft.Data.OData.Atom.ODataAtomWriter.EndEntry(ODataEntry entry) +627
Microsoft.Data.OData.ODataWriterCore.<WriteEndImplementation>b__16() +168
Microsoft.Data.OData.ODataWriterCore.InterceptException(Action action) +121
Microsoft.Data.OData.ODataWriterCore.WriteEndImplementation() +69
Microsoft.Data.OData.ODataWriterCore.WriteEnd() +40
System.Data.Services.Client.ODataWriterWrapper.WriteEnd(ODataEntry entry, Object entity) +47
System.Data.Services.Client.Serializer.WriteEntry(EntityDescriptor entityDescriptor, IEnumerable`1 relatedLinks, ODataRequestMessageWrapper requestMessage) +485
System.Data.Services.Client.BaseSaveResult.CreateRequestData(EntityDescriptor entityDescriptor, ODataRequestMessageWrapper requestMessage) +117
System.Data.Services.Client.BaseSaveResult.CreateChangeData(Int32 index, ODataRequestMessageWrapper requestMessage) +136
System.Data.Services.Client.SaveResult.CreateNonBatchChangeData(Int32 index, ODataRequestMessageWrapper requestMessage) +224
System.Data.Services.Client.SaveResult.CreateNextChange() +174
System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options) +178
System.Data.Services.Client.DataServiceContext.SaveChanges() +37
S3Tools.RunbookOperations.GetClusters(String site) in [redacted]\RunbookOps.cs:58
我查看了The UTC time represented when the offset is applied must be between year 0 and 10,000. Parameter name: offset 和UTC time represented when the offset is applied must be between year 0 and 10,000 error,它看起来很像调用https://support.microsoft.com/en-us/kb/2346777 的错误(尤其是后者),但 MS 提供的修补程序不适用于 Windows 10(我的工作站)或Windows 2012 R2(网络服务器)。
我不愿意更改我的时区 (UTC+10) 或服务器的时区,以便在查看是否有人有任何想法或以前遇到过这种情况之前进行测试。
我有 powershell 脚本,它们非常有能力生成这些作业(尽管它们不能使用您必须手动生成请求的服务引用)。所以我不倾向于相信除了 CLR 有任何问题。
底线问题:有人遇到过这个问题并解决了吗?
【问题讨论】:
-
今天早上我决定尝试更改我的工作站的时区,看看这是否有什么不同。它没有。我尝试了 UTC 和 UTC-12。所以我认为这不是结果。
-
我刚刚看到this technet article 可能有用。试一试。
标签: c#