简体   繁体   English

访问SSAS多维数据集中的LastProcessed属性时出错

[英]Error Accessing LastProcessed Property in SSAS Cube

I've got an assembly which sets a roles dimension data depending on the current user. 我有一个程序集,可根据当前用户设置角色维度数据。 In the assembly I need to access Context.CurrentCube.LastProcessed property. 在程序集中,我需要访问Context.CurrentCube.LastProcessed属性。 The code in itself works fine. 该代码本身可以正常工作。 Except when the Cube has been either newly deployed or processed. 除非已重新部署或处理了多维数据集。 Then sometimes retrieving Context.CurrentCube.LastProcessed property throws the following error: 然后,有时检索Context.CurrentCube.LastProcessed属性会引发以下错误:

Microsoft.AnalysisServices.AdomdServer.AdomdException: Server: The operation was cancelled by the user. Microsoft.AnalysisServices.AdomdServer.AdomdException:服务器:用户取消了该操作。 at Microsoft.AnalysisServices.AdomdServer.CubeCollection..ctor(String mpCubeName) at Microsoft.AnalysisServices.AdomdServer.CubeDef.get_LastProcessed() 在Microsoft.AnalysisServices.AdomdServer.CubeCollection..ctor(String mpCubeName)处,Microsoft.AnalysisServices.AdomdServer.CubeDef.get_LastProcessed()
at Reporting.TryGetLastProcessDate() in d:\\Projects\\reporting\\Reporting_Cube_Addons\\Permissions.cs:line 181 位于d:\\ Projects \\ reporting \\ Reporting_Cube_Addons \\ Permissions.cs:line 181中的Reporting.TryGetLastProcessDate()

I've wrapped that line in a try catch, with a fallback value: 我已经将该行包装在try catch中,具有后备值:

  public static DateTime TryGetLastProcessDate() { DateTime last; try { last = Context.CurrentCube.LastProcessed; } catch (Exception ex) { log("Failed to retrieved lastProcess Date. Error:"); log(ex.ToString()); last = new DateTime(2015, 01, 01); } return last; } 

But it seems that the cube stops work even though the exception has been caught.. 但是,即使已捕获到异常,多维数据集似乎仍然停止工作。

Any ideas on what I might be doing wrong? 关于我可能做错了什么的任何想法? Are there other more fail safe ways of retrieving the last processed date? 还有其他更多的故障安全方法来检索最后处理的日期吗?

I would recommend either installing ASSP or using this code . 我建议安装ASSP或使用此代码 Usage examples are here . 使用示例在这里

I recall like 10 years ago there was an issue with Context.CurrentCube.LastProcessed sometimes reflecting when your started the SSAS instance rather than when you processed the cube. 我记得大约十年前, Context.CurrentCube.LastProcessed存在问题,有时反映了您启动SSAS实例的时间,而不是您处理多维数据集的时间。 So we switched to this alternate approach. 因此,我们切换到了另一种方法。 I have no idea if that bug has been fixed and I'm not familiar with the crash you describe. 我不知道该错误是否已修复,并且对您描述的崩溃不熟悉。 But I hope the above approach works around it for you. 但我希望上述方法可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM