none
ReportViewer control partial trust remote mode causing partially trusted callers error RRS feed

  • Question

  • I am trying to get the ReportViewer control to work in medium trust using remote mode using Visual Studio 2008. I get the error:

    <div id="ReportViewer1" style="display:inline-block;height:400px;width:400px;">
     <!--
        at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
       at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
       at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
       at System.Web.Services.Protocols.MemberHelper.GetValue(MemberInfo memberInfo, Object target)
       at System.Web.Services.Protocols.SoapHeaderHandling.GetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest request, String methodName, Object[] parameters)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at Microsoft.SqlServer.ReportingServices2005.Execution.ReportExecutionService.LoadReport(String Report, String HistoryID)
       at Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)
       at Microsoft.Reporting.WebForms.ServerReport.GetExecutionInfo()
       at Microsoft.Reporting.WebForms.ServerReport.GetParameters()
       at Microsoft.Reporting.WebForms.ReportParameterSupplier.GetParameters()
       at Microsoft.Reporting.WebForms.ParametersArea.GetMetaDataFromReport()
       at Microsoft.Reporting.WebForms.ParametersArea.RefreshControlsFromReportMetadata()
       at Microsoft.Reporting.WebForms.ReportViewer.OnPreRender(EventArgs e)-->
     <ul>
      <li style="font-family:Verdana;font-weight:normal;font-size:8pt;display:inline;">That assembly does not allow partially trusted callers.</li>
     </ul>
    </div>

    I applied the HotFix KB961594 (http://support.microsoft.com/kb/961594) and I am running VS2008 PRO SP1 with Microsoft SQL Server 2008R2 Standard Edition.

    Is there any additional permissions I need in my medium trust policy file to allow the ReportViewer control to work in partial trust using Remote mode? I've read that the reportviewer will work in partial trust using remote mode. Below is the code in my file that is causing the error. For the "System.Security.CodeAccessSecurityEngine.ThrowSecurityException" in the error message above, was hoping to find what permissions were required to pass this security check, so we can run in medium/partial trust. My code below works fine if I switch back to full trust. I also have a webpermission defined in my policy file to allow access to the SSRS URI.

    <%

    @ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ReportViewerTest._Default" %>

    <%

    @ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

     

    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <!

     

    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <

     

    html xmlns="http://www.w3.org/1999/xhtml" >

    <

     

    head runat="server">

     

    <title></title>

    </

     

    head>

    <

     

    body>

     

    <form id="form1" runat="server">

     

    <div>

     

     

    <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote">

     

     

    <ServerReport DisplayName="test" ReportServerUrl="https://localhost/ReportServer" ReportPath = "/Report Project1/Report1"/>

     

    </rsweb:ReportViewer>

     

    </div>

     

    </form>

    </

     

    body>

    </

     

    html>

     

    Monday, August 23, 2010 12:17 PM