Report.Services 2008 - get page-count or row-count in the c#-code

hello
is it possible to get from the ReportViewer-control / ServerReport the page-count or row-count after the
reportViewerCheck.ServerReport.Refresh();
statement ??
many thanks in advance for any clue & regards
Michael

Hi Michael,
Yes, you can get them. For row count, you can add a parameter to store the row count of your dataset in your report.
Here are the steps:
1.     Add 2 datasets in your report, one for report use and the other on is to row count use. For instance:
DataSet1: SELECT     HumanResources.vEmployee.* FROM         HumanResources.vEmployee
DataSet2: SELECT     COUNT(*) FROM         HumanResources.vEmployee
2.     Add a parameter, set the parameter’s default value set to Get Values from a query and select DataSet2.
Then, in your ASP.NET web application code you can use the following function to get the row count of the report:
private int GetReportRowCount(ReportViewer report)
            return Convert.ToInt32(report.ServerReport.GetParameters()[0].Values[0].ToString());
For page count, you can refer to the following code:
private int GetReportPageCount(ReportViewer report)
            return report.ServerReport.GetTotalPages();
You may not get the correct row count and page count in after executing Refresh () method, that’s because when you run this method, it will start another thread to refresh the report and the code below Refresh () method will not wait refreshing complete but run it. For instance, you may get the page count as o if you run the following code in the Button event:
// Click this Button to refresh the ReportViewer1
        protected void btnGetPageCount_Click(object sender, EventArgs e)
            // Refresh the ReportViewer1
            this.ReportViewer1.ServerReport.Refresh();
            // Get ReportViewer1's page count and display in the txtPageCount TextBox
            this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
You can run the refresh in separate events and get page count in another event, such as below code:
        // Click this Button to refresh the ReportViewer1
        protected void btnGetPageCount_Click(object sender, EventArgs e)
            // Refresh the ReportViewer1
            this.ReportViewer1.ServerReport.Refresh();
        // Display the txtPageCount's text to ReportViewer's page count
        protected void btnGetPageCount2_Click(object sender, EventArgs e)
            // Get ReportViewer1's page count and display in the txtPageCount TextBox
            this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
Hope this helps! I would suggest you post a new thread in Visual Studio Report Controls forum if you need more help about using ReportViewer in ASP.NET web application.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Similar Messages

  • Reporting Services 2008 - Anonymous Access

    Hello,
    In SSRS 2005 I was able to grant anonymous access to my reports by changing the authentication mode for the Reporting Services virtual directory in IIS to Anonymous and then adding the 'account used for anonymous access' to the permissions on the appropriate Reporting Services directories (in report manager).
    Now with SSRS 2008 there are no virtual directories in IIS.
    I tried to follow the instructions given:
    http://technet.microsoft.com/en-us/library/cc281310.aspx (Authentication Types in Reporting Services)
    Which instructed me to use the custom AuthenticationType, and following the instructions here:
    http://technet.microsoft.com/en-us/library/cc281383.aspx (How to: Configure Custom or Forms Authentication in Reporting Services)
    which just got me an error:
    The Authentication Extension threw an unexpected exception or returned a value that is not valid: . (rsAuthenticationExtensionError) Get Online Help
    For more information about this error navigate to the report server on the local server machine, or enable remote errors
    Any ideas on how to set up anonymous access to SSRS2008?
    Thanks for any time and help!
    -Tim

    JC,
    I check the solution on net and get following:
    First create a class called ReportServerCredentials that implements the IReportServerCredentials interface.  You will need to import System.Net and Microsoft.Reporting.WebForms to this class.  Overload the New and GetFormsCredentials methods and the NetworkCredentials and ImpersonationUser properties.  Here's a class that I use:
    Imports Microsoft.VisualBasic
    Imports Microsoft.Reporting.WebForms
    Imports System.Net
    Public Class ReportServerCredentials
        Implements IReportServerCredentials
        Private _userName As String
        Private _password As String
        Private _domain As String
        Public Sub New(ByVal userName As String, ByVal password As String, ByVal domain As String)
            _userName = userName
            _password = password
            _domain = domain
        End Sub
        Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
            Get
                Return Nothing
            End Get
        End Property
        Public ReadOnly Property NetworkCredentials() As ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
            Get
                Return New NetworkCredential(_userName, _password, _domain)
            End Get
        End Property
        Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
            userName = _userName
            password = _password
            authority = _domain
            Return Nothing
        End Function
    End Class
    Next, in the OnLoad of your page with the ReportViewer control, create a new instance of your ReportServerCredentials (I use values stored in AppSettings).  Then assign your object to the ReportViewer control's ServerReport.ReportServerCredentials property. 
    Dim cred As New ReportServerCredentials(ConfigurationManager.AppSettings("MyStoredUser"),_
        ConfigurationManager.AppSettings("MyStoredPassword"), _
        ConfigurationManager.AppSettings("MyStoredDomain"))
        MyReportViewerControl.ServerReport.ReportServerCredentials = cred
    I try it but get following error
    Compiler Error Message: BC30002: Type 'IReportServerCredentials' is not defined.
    Do you think it is a possible way for Reporting Service 2008? if yes, what lead to the error? thanks in advance.

  • Expand and Collapse(+/-) option in a Matrix SQL Reporting Services 2008

    Hello All,
    I am having Expand and Collapse(+/-) option in a Matrix SQL Reporting Services 2008. It's not working when it is havnig a Row Group and Column Group.
    Does reporting services has this flexibulity?? It's working fine if it's only have a Row Group an it's not working if it is having Row and a Column Group. Can any one suggest how to work aroung with this.
    any help much appriciated.
    Thanks & Regards,
    Jeevan Dasari.
    Dasari

    Drill-down feature is a basic requirement, it is concluded in Reporting service from SSRS2000 to SSRS2008 R2, To
    your scenario I think the root cause is relevant to your incorrect steps. Please follow the steps below and then give the feedback:
    1.     Right-click the child groups in the
    Row Groups panel which is at the left-bottom of the BIDS, and then select
    Group Properties…
    2.   
    Switch to Visibility tab, and then select
    Hide Radio-button, click the checkbox of Display can be toggled by this report item.
    3.   
    Then select the parent group datafield in the drop-down list.
    4.   
    Click OK.
    Thanks,
    Challen Fu
    Challen Fu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Reporting Services 2008 R2 - SharePoint Integration Mode

    Hi everyone,
    I installed Reporting Services 2008 R2 in my SharePoint(2013) server and configurated the SSRS to run in SharePoint Integrate mode. But, when I run the command Install-SPRSService in SharePoint 2013 Management Shell, I get this error: 
    Does anyone know how resolve it ? I search but I didn't get a solution :(
    Thanks in advance!
    Best Regards!

    SSRS 2008 R2 isn't supported with SharePoint 2013. You'll need a minimum of SSRS 2012 SP1. In addition, SSRS 2008 R2 doesn't include the cmdlet you're looking for because it isn't a Service Application, rather it sat external to SharePoint.
    The support matrix is at http://msdn.microsoft.com/en-us/library/gg492257.aspx.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Report Builder 1.0 for SQL Server Reporting Services 2008 R2

    We are trying to implement Ad-Hoc Reporting using SSRS 2008 R2.
    First of all, it is very unhelpful that all SSRS books are for either 2008 or 2012, even though SSRS has major changes in 2008 R2 compared to 2008.
    Our instructional materials indicate that we should build Report Models to abstract out our databases into terms familiar to our business users.
    The problem we are having is the difference in functionality between Report Builder 1.0 and Report Builder 3.0. Report Builder 3.0 is touted as having the modern, ribbon based interface that is supposed to make end-users feel more comfortable.  However,
    all the documentation says that end users are supposed to use Report Builder 1.0 for Ad-Hoc Reporting.  And, it seems, that the reports generated by Report Builder 1.0 are not round-trip compatible with all the other reporting tools for SSRS 2008 R2.
    The documentation we have illustrates that Report Builder 1.0 is nice for Ad-Hoc reporting, because is based on connecting directly to Report Models, and the end users can directly drag-and-drop entities and fields into their reports.
    When we try working with Report Builder 3.0, it seems we must first connect to the Report Model as a Data Source and then build a Dataset query on the Report Model.  Only then are some entity attributes available to be dropped into the report. 
    If the user decides another source column is needed, they have to go back, edit the query, save the query, and then drag the column from the Dataset to the report.  This does not seem end user friendly at all!
    We are also concerned that if we train our users on the seemingly soon-to-be-obsolete Report Builder 1.0, and get them used to having direct Report Model access, that at some point we will have to move them to the Dataset-interrupted approach of Report Builder
    2+.  Highlighting this perception of impending obsolescence of Report Builder 1.0 is that in our shop that is starting with SSRS 2008 R2, we cannot figure out how to get a copy of Report Builder 1.0 in the first place.
    We just don't see our end users being savvy enough to handle the steps involved with creating Datasets on top of Report Model Data Sources.  So we would have to build the Datasets for them.  But in that case, what point is there in creating any
    Report Models in the first place if DBAs are the ones to make Datasets?
    As such, it is hard to envision a forward-looking SSRS implementation that has the end user ease-of-use Ad-Hoc reporting that the SSRS 2008 documentation presents.
    What is it that Microsoft actually wants/expects SSRS implementers to do?
    Dan Jameson
    Manager SQL Server DBA
    CureSearch for Children's Cancer
    http://www.CureSearch.org

    Hi Dan,
    Report Builder 1.0
    Simple template-based reports
    Requires report model
    Supports only SQL Server, Oracle, and Analysis Services as data sources
    Supports RDL 2005
    Bundled in SSRS
    Report Builder 2.0 or later
    Full-featured reports as the BIDS Report Designer
    Doesn't require (but supports) report models
    Supports any data source
    Supports RDL 2008
    Available as a separate web download
    In your scenario, you want to use Report Builder 1.0 in SQL Server Reporting Services 2008 R2, I am afraid this cannot achieve. Report Builder 1.0 is available in the box in either SQL 2005 or SQL 2008. It is not available as a separate client apps and is
    only available as a click once application.
    Report Builder 1.0
    Report Builder 3.0
    Thank you for your understanding.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • How to set a default date as a parameter in Microsoft Reporting Services 2008 to January 1st

    How can I set a default parameter for date for 01/01/yyyy.

    Hi Giss68,
    If I understand correctly, you want to set the first day of current year as a default value of a parameter in Microsoft Reporting Services 2008 report.
    If in this scenario, we can use the expression below as the default value in the parameter:
    =DateAdd("d",-DatePart(DateInterval.DayOfYear,Today,0,0)+1,Today)
    The following document about DateAdd function is for your reference:
    http://technet.microsoft.com/en-us/library/aa337194(v=sql.100).aspx
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Add SQL reporting services to get Azure sql db data

    Dear all,
    I have read recently that SQL server reporting services as been remmoved from Azure services. I have a SQL server database on azure which collect different type of data which are collected from a web admin portal by my users.
    I have a strong need to bring to that admin web portal a flexible reporting solution for my users to monitor collected data.
    Of course I can bring dash board to web application but often it is painful to change web app when a user want different type of report.
    What could be the way now to use online reporting service in orde to bring online report for my user of my sql azure database ?
    regards
    serge

    Hi serge,
    Based on my understanding, you want to use SQL Azure database to design the report, right?
    As you mentioned,
    Azure SQL Reporting is officially discontinued, so that we can’t design reports with Azure SQL Reporting. However, only the Azure cloud implementation of SQL Reporting is discontinued. All other forms of Reporting Services technology are unaffected. In
    Reporting services, it’s supported connect to SQL Azure database. So in your scenario, you can connect to the SQL Azure database to design the report. For more information, please refer to this article:
    How to connect to SQL Azure using SQL Server Reporting Services 2008 R2.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Getting the count of rows present in the oracle table

    Hi all,
    i want to get the total number of rows present in the sql table to the appmodule.
    After applying the some view criteria to the view object. if it try with getallrowsinrange it was giving count of rows present in the viewobject but i want total number of rows present in the sql table.
    How can i get that
    I am using jdev 11.1.1.5
    Thanks in advance

    I threw something together, quick and dirty, feel free to optimize.
    Assuming that you want the table count, I put the code into a EntityDefImpl subclass since this is what represents a table in the middle-tier.
    public class EmpDefImpl
          extends EntityDefImpl {
       * This is the default constructor (do not remove).
      public EmpDefImpl( ) {}
      //~ Methods ****************************************************************************
      public long getTableRowCount( DBTransaction transaction ) {
        String query = getQuery( );
        String countQuery = String.format( "SELECT COUNT(*) FROM (%s)", query );
        long count = 0;
        ViewObject vo = transaction.createViewObjectFromQueryStmt( countQuery );
        try {
          vo.executeQuery( );
          Row row = vo.first( );
          Number number = (Number)row.getAttribute( 0 );
          count = number.longValue( );
        } finally {
          vo.remove( );
        return count;
    }Depending on your type map, you might not get a oracle.jbo.domain.Number, but something else, so the cast might need correction.
    Usage example:
    public class EmpEditViewImpl extends ViewObjectImpl {
      public EmpEditViewImpl() {
      protected void executeQueryForCollection( Object object, Object[] object2, int i ) {
        super.executeQueryForCollection( object, object2, i );
        EmpDefImpl def = ( EmpDefImpl )getEntityDef( 0 );
        long tableRowCount = def.getTableRowCount( getDBTransaction() ) );
        // Do something with it
    }As you can see, the code is pretty generic. You might also be able to put this into an ADF extension base class.
    Sascha
    Edited by: Sascha Herrmann on Jun 7, 2012 2:39 PM

  • How do I get pages 5.2 to automatically update the date - use 10.9.2

    How do I get pages 5.2 to automatically update the date in my documents - before the update I could do this. Does anybody have the knowledge or a workaround.
    If not I will dump pages 5.2 and use my old version!!! this feature is important for any and all businesses using pages??
    Any advice on how to achieve this is greatly appreciated
    I use a number of macs all using OSX
    10.9.2

    I have the same problem.
    What confuses me is that all the apple provided templates in pages seem to auto update their time and date upon opening.
    So there MUST be a way to do it... Ive been unable to work out how...
    Amnon

  • Reporting Services will not automatically use a different replica for the report server databases when a failover occurs. How to overcome this issue

    Reporting Services offers limited support for using AlwaysOn Availability Groups with report server databases. The report server databases can be configured in AG to be part of a replica; however Reporting Services will not automatically use a different
    replica for the report server databases when a failover occurs. How to overcome this issue? is there any workaround for that..
    Rahul

    Hi.
    With the AlwaysOn listener you should have a single DNS name to connect to regardless of which cluster node is active. Are you using the listener service? If not, please refer to the link below.
    http://msdn.microsoft.com/en-us/library/hh213417.aspx#AGlisteners

  • How do I get pages to add a word to the dictionary when it just asks if I want to look it up?

    How do I get pages to add a word to the dictionary when it just asks if I want to look it up?

    Thanks, but my problem is that some words spell check and offer alternatives and/or add to dictionary, but others dot not - they simply want to look them up, when I want to add them to the dictionary. Is there any way I can FORCE it to add it to the dictionary?

  • Reporting Services 2008 error

    Good morning all,
    I'm using SQL Server 2008 R2 reporting services, and I'm having a problem with the report server and manager pages.  I've been able to configure everything in the Reporting Services Configuration Manager, and created the ReportServer and ReportServerTempDB
    databases in my SQL Server instance, but when I try to hit either the Web Service URL or the Report Manager URL, I get a 500 error.  The stack trace is below, with the error lines in bold.  If anyone could help, I would really appreciate it. 
    Thanks.
    rshost!rshost!4c4!08/17/2010-09:19:53:: i INFO: Application domain type ReportManager statistics: created: 11, unloaded: 11, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:53:: i INFO: Appdomain:29 ReportManager_MSSQLSERVER_0-23-129265247936138778 started.
    rshost!rshost!4c4!08/17/2010-09:19:53:: i INFO: Application domain type ReportManager statistics: created: 12, unloaded: 12, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:53:: i INFO: Appdomain:30 ReportManager_2-24-129265247938638554 started.
    rshost!rshost!4c4!08/17/2010-09:19:54:: i INFO: Application domain type ReportManager statistics: created: 13, unloaded: 13, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:54:: i INFO: Appdomain:31 ReportManager_3-25-129265247940669622 started.
    rshost!rshost!4c4!08/17/2010-09:19:54:: i INFO: Application domain type ReportManager statistics: created: 14, unloaded: 14, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:54:: i INFO: Appdomain:32 ReportManager_4-26-129265247942700690 started.
    rshost!rshost!4c4!08/17/2010-09:19:54:: i INFO: Application domain type ReportManager statistics: created: 15, unloaded: 15, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:54:: i INFO: Appdomain:33 ReportManager_5-27-129265247944731758 started.
    rshost!rshost!4c4!08/17/2010-09:19:54:: i INFO: Application domain type ReportManager statistics: created: 16, unloaded: 16, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:54:: i INFO: Appdomain:34 ReportManager_6-28-129265247946762826 started.
    rshost!rshost!4c4!08/17/2010-09:19:55:: i INFO: Application domain type ReportManager statistics: created: 17, unloaded: 17, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: i INFO: Appdomain:35 ReportManager_7-29-129265247948793894 started.
    rshost!rshost!4c4!08/17/2010-09:19:55:: i INFO: Application domain type ReportManager statistics: created: 18, unloaded: 18, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: i INFO: Appdomain:36 ReportManager_8-30-129265247950981198 started.
    rshost!rshost!4c4!08/17/2010-09:19:55:: i INFO: Application domain type ReportManager statistics: created: 19, unloaded: 19, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: i INFO: Appdomain:37 ReportManager_9-31-129265247953168502 started.
    rshost!rshost!4c4!08/17/2010-09:19:55:: i INFO: Application domain type ReportManager statistics: created: 20, unloaded: 20, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: i INFO: Appdomain:38 ReportManager_10-32-129265247955355806 started.
    rshost!rshost!4c4!08/17/2010-09:19:55:: i INFO: Application domain type ReportManager statistics: created: 21, unloaded: 21, failed: 0, timed out: 0.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: i INFO: Appdomain:39 ReportManager_11-33-129265247957386874 started.
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: e ERROR: AppDomain ReportManager_11 failed to start. Error: The configuration system has already been initialized.
    library!DefaultDomain!4c4!08/17/2010-09:19:55:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException: Failed to create HTTP Runtime, Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
    An internal or system error occurred in the HTTP Runtime object for application domain ReportManager_11.  ---> System.InvalidOperationException: The configuration system has already been initialized.
       at System.Configuration.ConfigurationManager.SetConfigurationSystem(IInternalConfigSystem configSystem, Boolean initComplete)
       at System.Configuration.Internal.InternalConfigSettingsFactory.System.Configuration.Internal.IInternalConfigSettingsFactory.SetConfigurationSystem(IInternalConfigSystem configSystem, Boolean initComplete)
       at System.Web.Configuration.HttpConfigurationSystem.EnsureInit(IConfigMapPath configMapPath, Boolean listenToFileChanges, Boolean initComplete)
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
       at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.CreateObject(String appId, Type type, String virtualPath, String physicalPath, Boolean failIfExists, Boolean throwOnError)
       at ReportingServicesHttpRuntime.RsHttpRuntime.Create(RsAppDomainType type, String vdir, String pdir, Int32& domainId)
       --- End of inner exception stack trace ---;
    appdomainmanager!ReportManager_11-33-129265247957386874!4c4!08/17/2010-09:19:55:: i INFO: Appdomain:39 ReportManager_11-33-129265247957386874 unloading
    appdomainmanager!DefaultDomain!4c4!08/17/2010-09:19:55:: e ERROR: AppDomain:ReportManager_11-33-129265247957386874 failed to unload. Error: System.ArgumentNullException: Value cannot be null.
    Parameter name: WaitCallback
    Server stack trace:
       at System.Threading.ThreadPool.QueueUserWorkItemHelper(WaitCallback callBack, Object state, StackCrawlMark& stackMark, Boolean compressStack)
       at System.Threading.ThreadPool.QueueUserWorkItem(WaitCallback callBack)
       at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
       at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
       at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
       at System.Web.HttpRuntime.ShutdownAppDomain(ApplicationShutdownReason reason, String message)
       at System.Web.HttpRuntime.UnloadAppDomain()
       at Microsoft.ReportingServices.AppDomainManager.RsAppDomainManager.UnloadAspDomain(Boolean memoryRecycle)
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Microsoft.ReportingServices.AppDomainManager.RsAppDomainManager.UnloadAspDomain(Boolean memoryRecycle)
       at Microsoft.ReportingServices.AppDomainManager.RsAppDomainManager.CreateHttpRuntime(RsAppDomainType appDomainType, String vdir, String pdir, Int32& domainId).
    library!DefaultDomain!4c4!08/17/2010-09:19:55:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerAppDomainManagerException: Failed to create Report Server HTTP Runtime, Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerAppDomainManagerException:
    An error occurred when attempting to start the application domain ReportManager within the Report Server service. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException: An internal or system error occurred in the
    HTTP Runtime object for application domain ReportManager_11.  ---> System.InvalidOperationException: The configuration system has already been initialized.
       at System.Configuration.ConfigurationManager.SetConfigurationSystem(IInternalConfigSystem configSystem, Boolean initComplete)
       at System.Configuration.Internal.InternalConfigSettingsFactory.System.Configuration.Internal.IInternalConfigSettingsFactory.SetConfigurationSystem(IInternalConfigSystem configSystem, Boolean initComplete)
       at System.Web.Configuration.HttpConfigurationSystem.EnsureInit(IConfigMapPath configMapPath, Boolean listenToFileChanges, Boolean initComplete)
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
       at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists, HostingEnvironmentParameters hostingParameters)
       at System.Web.Hosting.ApplicationManager.CreateObject(String appId, Type type, String virtualPath, String physicalPath, Boolean failIfExists, Boolean throwOnError)
       at ReportingServicesHttpRuntime.RsHttpRuntime.Create(RsAppDomainType type, String vdir, String pdir, Int32& domainId)
       --- End of inner exception stack trace ---
       at ReportingServicesHttpRuntime.RsHttpRuntime.Create(RsAppDomainType type, String vdir, String pdir, Int32& domainId)
       at Microsoft.ReportingServices.AppDomainManager.RsAppDomainManager.CreateHttpRuntime(RsAppDomainType appDomainType, String vdir, String pdir, Int32& domainId)
       --- End of inner exception stack trace ---;
    rshost!rshost!4c4!08/17/2010-09:19:55:: e ERROR: Failed to create HttpRuntime 80131500.
    rshost!rshost!4c4!08/17/2010-09:19:55:: e ERROR: Failed to get appdomain 80131500, pipeline=0x00F99350.
    rshost!rshost!4c4!08/17/2010-09:19:55:: e ERROR: Error state. Internal abort for pipeline=0x00F99350 ...

    Hi Chris,
    From the error messages you posted, the error is caused by the Reporting Services is not able to create the HttpRuntime.
    Based on my research, the issue should be caused by the account the Reporting Services is running under does not have sufficient privilege to write files under folder 'RSTempFiles'.
    To verify the cause, please check if there is message that resembles the following error message in the Reporting Services error logs:
    Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerAppDomainManagerException: An error occurred when attempting to start the application domain ReportManager within the Report Server service. --->
    Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException: An internal or system error occurred in the HTTP Runtime object for application domain ReportManager_MSSQLSERVER_0. ---> System.Web.HttpException: The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\RSTempFiles\'.
    In case we can verify the issue is caused by insufficient privilege to write files to 'RSTempFiles', we can assign the mentioned account (Service Account) the permissions to write files to the folder to solve the issue.
    Generally speacking, giving permission to the service account in the folder per log error in reporting services granted access.
    If you have any more questions, please feel free to ask.
    Thanks,
    Jin Chen
    Jin Chen - MSFT

  • Printing directly to printer in Reporting Services 2008 problem

    We have recently installed a new SQL 2008 server.  I have an application that prints an SSRS report (2005) directly to the printer.  If I change the reference to point to the new SQL 2008 server and run the application, the report is printed but the font size is huge and the report doesn't fit on the paper.  The only change I made in the code is the reference, that is it. Any ideas why this is happening?
    Thanks

    I guess I wasn't clear with my current configuration.  I am using the SOAP interface to print the reports directly to the printer.  I have a web reference (ReportServer) pointing to the new server and here is the code I use to print the report:
    public class ReportPrinter
            //ReportingService rs;
            ReportServer.ReportExecutionService rs;      
            private byte[][] m_renderedReport;
            private Graphics.EnumerateMetafileProc m_delegate = null;
            private MemoryStream m_currentPageStream;
            private Metafile m_metafile = null;
            int m_numberOfPages;
            private int m_currentPrintingPage;
            private int m_lastPrintingPage;
            private string _printer = "";
            public ReportPrinter()
                rs = new ReportServer.ReportExecutionService();
                rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
                PrintDialog dlgPrint = new PrintDialog();
                dlgPrint.PrinterSettings = new PrinterSettings();
                if (Common.gPrinterToUse == "" ||Common.gPrinterToUse == null)
                    if (dlgPrint.ShowDialog() == DialogResult.OK)
                        _printer = dlgPrint.PrinterSettings.PrinterName;
                        Common.gPrinterToUse = _printer;
                    else
                        return;
                else
                    _printer = Common.gPrinterToUse;
            private byte[][] RenderReport(string reportPath, ParameterValue[] reportParameters)
                // Private variables for rendering
                string deviceInfo = null;
                string format = "IMAGE";
                Byte[] firstPage = null;
                string encoding;
                string mimeType;
                Warning[] warnings = null;
                ParameterValue[] reportHistoryParameters = null;
                string[] streamIDs = null;
                Byte[][] pages = null;
                string extension = null;
                string historyID = null;       
                // Build device info based on the start page
                deviceInfo = String.Format(@"<DeviceInfo><OutputFormat>{0}</OutputFormat></DeviceInfo>", "emf");
                ExecutionInfo execInfo = new ExecutionInfo();
                ExecutionHeader execHeader = new ExecutionHeader();
                rs.ExecutionHeaderValue = execHeader;
                execInfo = rs.LoadReport(reportPath, historyID);
                rs.SetExecutionParameters(reportParameters, "en-us");
                rs.Url = "http://hr-sqlsvr3/reportserver/ReportExecution2005.asmx";
                //Execute the report and get page count.
                try
                    // Renders the first page of the report and returns streamIDs for 
                    // subsequent pages
                    //firstPage = rs.Render(
                    firstPage = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);
                    // The total number of pages of the report is 1 + the streamIDs         
                    m_numberOfPages = streamIDs.Length + 1;
                    pages = new Byte[m_numberOfPages][];
                    // The first page was already rendered
                    pages[0] = firstPage;
                    for (int pageIndex = 1; pageIndex < m_numberOfPages; pageIndex++)
                        // Build device info based on start page
                        deviceInfo =
                            String.Format(@"<DeviceInfo><OutputFormat>{0}</OutputFormat><StartPage>{1}</StartPage></DeviceInfo>",
                            "emf", pageIndex + 1);
                        pages[pageIndex] = rs.Render(format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);
                catch (SoapException ex)
                    Console.WriteLine(ex.Detail.InnerXml);
                catch (Exception ex)
                    Console.WriteLine(ex.Message);
                    MessageBox.Show(ex.InnerException +
                        Environment.NewLine + ex.Message +
                        Environment.NewLine + "Number of pages: " + pages.Length.ToString() +
                        Environment.NewLine + "Report Path: " + reportPath, "Error Printing");
                finally
                    Console.WriteLine("Number of pages: {0}", pages.Length);
                return pages;
            internal bool PrintReport(string report, ParameterValue[] reportParameters, bool landscape)
                this.RenderedReport = this.RenderReport(report, reportParameters);
                try
                    // Wait for the report to completely render.
                    if (m_numberOfPages < 1)
                        return false;
                    PrinterSettings printerSettings = new PrinterSettings();
                    printerSettings.MaximumPage = m_numberOfPages;
                    printerSettings.MinimumPage = 1;
                    printerSettings.PrintRange = PrintRange.SomePages;
                    printerSettings.FromPage = 1;
                    printerSettings.ToPage = m_numberOfPages;
                    printerSettings.PrinterName = _printer;
                    PrintDocument pd = new PrintDocument();
                    m_currentPrintingPage = 1;
                    m_lastPrintingPage = m_numberOfPages;
                    pd.PrinterSettings = printerSettings;
                    pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
                    pd.DefaultPageSettings.Landscape = landscape;
                    // Print report
                    Console.WriteLine("Printing report...");
                    pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
                    pd.Print();
                catch (Exception ex)
                    Console.WriteLine(ex.Message);
                finally
                    // Clean up goes here.
                return true;
            private void pd_PrintPage(object sender, PrintPageEventArgs ev)
                ev.HasMorePages = false;
                if (m_currentPrintingPage <= m_lastPrintingPage && MoveToPage(m_currentPrintingPage))
                    // Draw the page
                    ReportDrawPage(ev.Graphics);
                    // If the next page is less than or equal to the last page, 
                    // print another page.
                    if (++m_currentPrintingPage <= m_lastPrintingPage)
                        ev.HasMorePages = true;
            // Method to draw the current emf memory stream 
            private void ReportDrawPage(Graphics g)
                if (null == m_currentPageStream || 0 == m_currentPageStream.Length || null == m_metafile)
                    return;
                lock (this)
                    // Set the metafile delegate.
                    int width = m_metafile.Width;
                    int height = m_metafile.Height;
                    m_delegate = new Graphics.EnumerateMetafileProc(MetafileCallback);
                    // Draw in the rectangle
                    // Point destPoint = new Point(0, 0);
                    Point[] destPoint = new Point[3];
                    Point point1 = new Point(0, 0);
                    Point point2 = new Point(width, 0);
                    Point point3 = new Point(0, height);
                    destPoint[0] = point1;
                    destPoint[1] = point2;
                    destPoint[2] = point3;
                    g.EnumerateMetafile(m_metafile, destPoint, m_delegate);
                    // Clean up
                    m_delegate = null;
            private bool MoveToPage(Int32 page)
                // Check to make sure that the current page exists in
                // the array list
                if (null == this.RenderedReport[m_currentPrintingPage - 1])
                    return false;
                // Set current page stream equal to the rendered page
                m_currentPageStream = new MemoryStream(this.RenderedReport[m_currentPrintingPage - 1]);
                // Set its postion to start.
                m_currentPageStream.Position = 0;
                // Initialize the metafile
                if (null != m_metafile)
                    m_metafile.Dispose();
                    m_metafile = null;
                // Load the metafile image for this page
                m_metafile = new Metafile((Stream)m_currentPageStream);
                return true;
            private bool MetafileCallback(EmfPlusRecordType recordType,int flags,int dataSize,IntPtr data,PlayRecordCallback callbackData)
                byte[] dataArray = null;
                // Dance around unmanaged code.
                if (data != IntPtr.Zero)
                    // Copy the unmanaged record to a managed byte buffer 
                    // that can be used by PlayRecord.
                    dataArray = new byte[dataSize];
                    Marshal.Copy(data, dataArray, 0, dataSize);
                // play the record.      
                m_metafile.PlayRecord(recordType, flags, dataSize, dataArray);
                return true;
            internal byte[][] RenderedReport
                get
                    return m_renderedReport;
                set
                    m_renderedReport = value;

  • Reporting Services 2008 R2 configuration error: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    Hi, I am using SQL Server 2008 R2 and on one of our dev boxes I am trying to setup ReportServer using ReportingServices Configuration manager. This is was installed longtime back and during installation they created a service account for reporting services.
    When I try to configure the service account I do not get the service account created during the installation in the pull down and if I were to use something different I get this "Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"
    error.
    Thanks in advance...........
    Ione

    Hi,
    Take a look at this blog - http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx
    I hope it will help.

  • SQL Server Reporting Service 2008 R2 - The request failed with HTTP status 401: Unauthorized.

    I got the error "The request failed with HTTP status 401: Unauthorized." when I call the Reporting Service Web Service.
    The code is very simple:
    // Initialise the reporting service Web Service
    this.RSWebService = new ReportingService2010();
    // Pass windos authentication credentials to Web Service
    this.RSWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;
    // List children
    List<CatalogItem> reports = this.RSWebService.ListChildren(folder, false).ToList();
    The SQL Server is installed on a different machine (say server A) from the Web server (say server B). We are using Windows Server 2003.
    The code work fine for all the scenario below:
    i) Run locally (XP) to call the web service on the sql server
    ii) Provide the Network Credentials with the username, password, and domain when calling the web service
    iii) If the web server and sql server is using same server (i.e. not distributed)
    I'm using windows authentication and impersonation. Any idea?

    Hi Raymond,
    If I understand correctly, the issue only happens in the environment that the web server is different with the SQL Server Reporting Services server. This means the web server is a remote server of the Report Server. Windows Integrated authentication is used
    in this case. When running the web page, the 401 error occurs.
    If so, it is actually a double hop issue. The double-hop problem will usually only be an issue to those of you who write some sort of web-based code (a web application or web service) that uses impersonation.
    To fix the issue, we can configure kerberos authentication for the web application and the SQL Server Reporting Services.
    Below is a great article that has delivered many solutions to fix the issue you met:
    http://odetocode.com/articles/216.aspx
    Additionally, you can read the following article to know more about double-hop:
    http://blogs.technet.com/b/askds/archive/2008/06/13/understanding-kerberos-double-hop.aspx
    http://blogs.msdn.com/b/knowledgecast/archive/2007/01/31/the-double-hop-problem.aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Jin Chen
    Jin Chen - MSFT
    Thanks Jin. I believe this is the cause of the problem as well.
    I tried to register the SPN but unfortunately it still doesn't work. I'm not sure whether I'm using the correct SPN name.
    I have 3 reporting server instance on the SQL box. So the Web Service URL is like
    http://Server:80/VirtualDirectoryDev,
    http://Server:80/VirtualDirectoryTest  and
    http://Server:80/VirtualDirectoryStaging .
    What's the SPN I need to register?
    I tried
    Setspn -a http/Server:80/VirtualDirectoryDev domain\account
    and
    Setspn -a http/aerver:80 domain\account.
    But both of them are not working :(

Maybe you are looking for

  • I only want one desktop.How can I get rid of a 2nd desktop?

    I have desktops to choose from. I could see where this mught be handy, but riight now I find it downright annoying to suddenly switch desktops because I swiped or did something else to make i switch. I cannot find a setting for multiple desktops.

  • Mac book pro will not boot up

    My macbook pro will not boot up. Can anyone help me?

  • Safari - Many Websites Are Not Loading

    Does anyone else have the same problem as the one below? Ever since I upgraded to Leopard (day of release) there have been plenty of websites that do not finish loading, and what happens is that the tabs/websites just keep spinning. My ISP says nothi

  • Updating MARA

    hi All,     Is it possible to update the cotent on a field in MARA using an UPDATE statement? thanks for ur help...pl let me know

  • Broken Pipe error  when connecting to database

    Hi I have installed ODI and Oracle 10g database on my machine. But getting a Broken Pipe error while creating an entity in Oracle Data Profiling and Quality tool Or I can say while connecting database. It's a runtime error. Server terminated the appl