Azure ReportViewer 在 DevFabric 中工作正常,但在 Azure 部署中引发异常
我有一个 VS 2010 WebForm 应用程序,它使用 ReportViewer 控件,并且它在 SqlAzure 数据库的本地 DevFabric 上完美运行,并使用 SqlAzure 会话状态(对于 ReportViewer)。
该应用程序还使用 ACS Federation,它在本地 DevFabric 和部署的 azure webrole 中都运行良好。
webrole(2 个实例)现在配置为 FullTrust
,已添加 ReportViewer 和相关的 rdlc,当我部署到云时,我可以让 ReportViewer 进行渲染,但不会获取任何数据,而是出现如下异常:
tablix 'TimesheetDate' 的隐藏表达式包含错误:请求类型为 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 失败。
正如我所说,这在本地 DevFabric 中完美运行,但在使用隐藏字段的任何报告的 Azure webrole(2 个实例)中失败。
显然,该表达式导致了安全问题,但由于这是 Azure,我不确定在哪里可以更改设置
有人知道吗?
编辑:刚刚发现这是一个可能的修复:
ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(
new System.Security.PermissionSet(
System.Security.Permissions.PermissionState.Unrestricted));
I have a VS 2010 WebForm application which uses a ReportViewer control and it is running perfectly on the local DevFabric off the SqlAzure database and using SqlAzure Session state (for the ReportViewer).
The application also uses ACS Federation which all works fine both in local DevFabric and in the deployed azure webrole.
The webrole (2 instances) are configured with FullTrust
Now, having added in the ReportViewer and related rdlcs, When I deploy to the cloud I can get the ReportViewer to render but rather than get any data I get an exception as follows :
The Hidden expression for the tablix ‘TimesheetDate’ contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
As I stated, this works perfectly in local DevFabric but fails in Azure webrole (2 instances) on any reports where the Hidden field is used.
Clearly the expression is causing a security issue but as this is Azure I am uncertain about where I can go about changing settings
Anybody have any idea?
EDIT: Just found this as a possible fix:
ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(
new System.Security.PermissionSet(
System.Security.Permissions.PermissionState.Unrestricted));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此修复已在 Azure WebRole 中使用并且运行良好。
鉴于 Azure 修补是“标准”,因此其他修补程序不太可能导致问题。
自 2011 年 10 月下旬以来,编辑中的代码一直在部署的 Azure 环境中运行
This fix was utilised in an Azure WebRole and worked fine.
Given that Azure patching is 'standard' then it is less likely that a other patches might cause an issue.
The code in the EDIT has been working in a deployed Azure environment since late October 2011