相关疑难解决方法(0)

从C#执行SSRS报告另存为PDF

所以,这是我的想法。

标题说明了一切。我似乎找不到任何有关如何远程执行SSRS报告并将其另存为PDF的指导。

我试图遵循以下文章。 在ASP.NET Core网站中使用Reporting Services(SSRS)作为参考

但是,当我将Service Reference添加到我的项目中时,某些方法似乎具有错误的签名。

例如。rsExec.LoadReportAsync(report,null);

在我的参考资料中,第一个参数是TrustedUserHeader对象。

有没有人有一个很好的起点,说明如何从C#执行SSRS报告?我找不到任何简单的例子。

c# reporting-services

7
推荐指数
1
解决办法
8506
查看次数

Asp.Net Core:在客户端浏览器上下载 PDF 格式的 SSRS 报告

我有一个 SSRS 报告 URL,如果我在浏览器中输入该 URL,则会显示带有打印和保存选项的 SSRS 报告,如下所示:

在此输入图像描述

这在浏览器上运行良好。

我想要的是,页面上有一个按钮.cshtml,因此通过单击该按钮,我需要在客户端浏览器上下载报告。

网址:http://xyz/ReportS/report/UAT/SampleReport_V1?Srno=X123

我尝试过的:

通过设置&rs:Format=PDF并从 Asp.Net Core 应用程序发出 HTTP 请求,但它生成了 PDF,但格式已损坏。

代码:

public void Download_SSRSInPDF()
{
    string URL = "http://xyz/ReportS/report/UAT/SampleReport_V1";
    string Command = "Render";
    string Format = "PDF";
    URL = URL + "?SrNo=X123&rs:Command=" + Command + "&rs:Format=" + Format;
    System.Net.HttpWebRequest Req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(URL);

    Req.Credentials = System.Net.CredentialCache.DefaultCredentials;
    Req.Method = "GET";
    string path = @"E:\New folder\Test.pdf";
    System.Net.WebResponse objResponse = Req.GetResponse();
    System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
    System.IO.Stream stream = objResponse.GetResponseStream(); …
Run Code Online (Sandbox Code Playgroud)

c# reporting-services asp.net-core

7
推荐指数
1
解决办法
6136
查看次数

.Net Core ReportExecutionServiceSoapClient设置凭据

我在.Net Core中使用ReportExecutionServiceSoapClient我得到了.net Core的最新版本,并尝试从报告服务中获取报告.在我使用WCF连接服务之后,我能够添加看起来像下面的代码

        // Instantiate the Soap client
        ReportExecutionServiceSoap rsExec = new ReportExecutionServiceSoapClient(ReportExecutionServiceSoapClient.EndpointConfiguration.ReportExecutionServiceSoap);
        // Create a network credential object with the appropriate username and password used
        // to access the SSRS web service
        string historyID = null;
        TrustedUserHeader trustedUserHeader = new TrustedUserHeader();
        ExecutionHeader execHeader = new ExecutionHeader();

        // Here we call the async LoadReport() method using the "await" keyword, which means any code below this method
        // will not execute until the result from the LoadReportAsync task is returned

        var …
Run Code Online (Sandbox Code Playgroud)

authentication wcf soap reporting-services asp.net-core

6
推荐指数
1
解决办法
965
查看次数