Exemplo n.º 1
0
        public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = new CancellationToken())
        {
            try
            {
                var rsClient = CreateReportService2010Client();

                ReportService2010.TrustedUserHeader trustedUserHeader = new ReportService2010.TrustedUserHeader();

                // Call to an arbitrary method
                await rsClient.ListExtensionsAsync(trustedUserHeader, "Render");
            }
            catch (Exception ex)
            {
                return(new HealthCheckResult(context.Registration.FailureStatus, exception: ex, description: "ReportService2010 is not available."));
            }

            try
            {
                var rsClient = CreateReportExecution2005Client();

                ReportExecution2005.TrustedUserHeader trustedUserHeader = new ReportExecution2005.TrustedUserHeader();

                // Call to an arbitrary method
                await rsClient.ListRenderingExtensionsAsync(trustedUserHeader);
            }
            catch (Exception ex)
            {
                return(new HealthCheckResult(context.Registration.FailureStatus, exception: ex, description: "ReportExecution2005 is not available."));
            }

            return(HealthCheckResult.Healthy());
        }
        private async Task <ReportService2010.CatalogItem[]> ListChildren(string folderPath, bool recursive)
        {
            var rsClient = CreateReportService2010Client();

            ReportService2010.TrustedUserHeader trustedUserHeader = new ReportService2010.TrustedUserHeader();

            ReportService2010.ListChildrenResponse listChildrenResponse = await rsClient.ListChildrenAsync(trustedUserHeader, folderPath, recursive);

            return(listChildrenResponse.CatalogItems);
        }