Report Viewer Control with 'Code' fields code calling into WCF is failing RRS feed

  • Question

  • Hi

    Here is the environment I am having this issue in

    - ASP.NET 3.x
    - Local Report (RDLC)
    - FullTrust configured
    - ASP.NET web.config configured with 

        <authentication mode="Windows"/>
        <identity impersonate="true"/>

    - From within Visual Studio 2008 IDE Debug Environment
    - IE7
    - Report contains a text field with a 'Code' expression calling into a DLL that connects to a WCF service similar to


    - Report also contains a text field with a 'Code' expression calling into a DLL that returns back data - and DOES NOT call any WCF operation


    - On pageload, I am doing a

    ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain(@"mydatasourcedll, Version=, Culture=neutral, PublicKeyToken=9b3cabc49b785a47");

    - The WCF endpoint with WSHttpBinding; WCF Operation being called is configured with a

          'Impersonation = ImpersonationOption.Required'

    The DLL is calling the WCF operation with

    webService.ClientCredentials.Windows.AllowedImpersonationLevel =  

    When displayed in an ASPX page, the Report Viewer control displays the field with the non-WCF call code (=Code.myClassInstance.TestSimpleCall()) fine.

    But, the field with the WCF call code (=Code.myClassInstance.TestWebServiceCall()) fails with an exception text message:

    The WSHttpBinding with name WSHttpBinding failed validation because it contains a BindingElement with type 
    System.ServiceModel.Channels.SymmetricSecurityBindingElement which is not supported in partial trust. 
    Consider disabling the message security and reliable session options, using BasicHttpBinding, 
    or hosting your application in a full-trust environment

    My question is:

    My app is already hosted in a full-trust environment; I am able to see other report fields fine.  The same call to WCF operation from outside of 'report viewer control on the same web page works fine.  But doesn't work from within the Report Viewer control.
    Is there a limitation to using WCF calls from within 'Code' field in a Report Viewer Control (Local Reports). 
    Is there any configuration that I am missing?

    I really appreciate any help or pointers regarding this issue.

    - Athadu

    Thursday, October 22, 2009 3:30 PM


  • Hi

    I figured it out...

    I needed to do the following in page_load, in that order ...

    ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain(@"mydatasourcedll, Version=, Culture=neutral, PublicKeyToken=9b3cabc49b785a47");
    Now it works!

    - Athadu
    • Marked as answer by Athadu S Thursday, October 22, 2009 5:54 PM
    Thursday, October 22, 2009 5:53 PM