簡體   English   中英

SQL Server Reporting Services Web服務在處理參數時發生異常,在vs2015中預覽,在報表服務器上調用

[英]Sql Server Reporting Services Webservice Exception on processing Parameter, preview in vs2015 works, call on report server works

該錯誤可能是由於將VS 2013解決方案升級到VS 2015引起的。在遷移期間,無法遷移Report-Project,因此我不得不添加一個新項目並將Compatibility設置為“ Sql Server 2008”。 根據另一個線程,我將Debug-Folder中的.rdl文件部署到了ReportServer,因為SourceFile仍然指向2016。

在預覽期間,通過組合框選擇參數,用戶在其中選擇一個字符串,並提供一個id作為Reportparameter。

ReportExecutionService.Render引發異常:

“處理'paraDepot'報告參數期間發生錯誤。---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:“處理'paraDepot'報告參數期間發生錯誤。

<ReportParameters>
<ReportParameter Name="paraDepot">
<DataType>String</DataType>
<DefaultValue>
<DataSetReference>
<DataSetName>DepotNames</DataSetName>
<ValueField>ID_DEPOT</ValueField>
</DataSetReference>
</DefaultValue>
<Prompt>Depot</Prompt>
<ValidValues><DataSetReference>
<DataSetName>DepotNames</DataSetName>
<ValueField>ID_DEPOT</ValueField>
<LabelField>DEPOT</LabelField>
</DataSetReference></ValidValues>
</ReportParameter>
...
</ReportParameters>

該報告僅具有一些其他字段,但與從vs 2013開始的Windows7環境中部署的字段相同。因此我將報告復制到另一個文件中,例如ReportV2015.rdl。

如果我采用從Windows7部署到Report-File的report-Path,請稱其為ReportV2013.rdl,而不是Render方法起作用的。

那么,是否可能是由於安裝的庫的版本組合不當而引起的? SSDT(SQL Server數據工具)的版本重要嗎?

VS2015和VS2013也在不同的虛擬機上運行。 那么,我將不得不檢查哪些庫的版本?

ReportService調用:ReportServer / Reportexecution2005.asmx。 渲染方法使用DevInfo參數:@“ False”

任何想法表示贊賞。 實際上,我擔心不得不再次降級至vs2013並在報告文件中重新進行升級,因為我已經花了大約2天的時間才有結果。

因此,這是從應用程序調用報告的方式:

ReportExecutionService loReportingService = new ReportExecutionService();
loReportingService.Url = "http://10.20.30.40/ReportServer/Reportexecution2005.asmx"; // (IP changed)
loReportingService.Credentials = new System.Net.NetworkCredential( ltReportuser, ltReportPassword, ltReportDomain );

string ltDevInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

// Setting the Parameters:
ParameterValue loDepot = new ParameterValue();
                loDepot.Name = "paraDepot";
                loDepot.Value = poShift.ID_DEPOT.ToString();
// ... ParameterValue loShiftType ...           

ParameterValue loShiftDate = new ParameterValue();
loShiftDate.Name = "paraDate";
// loShiftDate.Value = poShift.DATE.ToString( "dd/MM/yyyy" ); // seems to make no difference
loShiftDate.Value = poShift.DATE.ToString("dd.MM.yyyy");

ParameterValue[] laReportingServiceParameter = { loDepot, loShiftType, loShiftDate };

string ltHistoryID = null; // ltReportPath is just the Path to the .rdl File
loReportingService.ExecutionHeaderValue = new ExecutionHeader();
//Load the Report
var execInfo = loReportingService.LoadReport( ltReportPath, ltHistoryID );
//Set Parameters for Report
execInfo = loReportingService.SetExecutionParameters( laReportingServiceParameter, "de-DE" );

// Instruction which throws the Exception:
result = loReportingService.Render( "PDF", ltDevInfo, out ltExtension, out ltEncoding, out ltMimeType, out laWarnings, out laStreamIDs );

SoapException的一些詳細信息:

<ErrorCode xmlns="http://www.microsoft.com/sql/reportingservices">
rsReportParameterProcessingError
</ErrorCode>
<HttpStatus xmlns="http://www.microsoft.com/sql/reportingservices">
400
</HttpStatus>
<Message xmlns="http://www.microsoft.com/sql/reportingservices">
Error during processing of ‘paraDepot’ report parameter.
</Message>
<HelpLink xmlns="http://www.microsoft.com/sql/reportingservices">
http://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsReportParameterProcessingError&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=11.0.5058.0
</HelpLink>
<ProductName xmlns="http://www.microsoft.com/sql/reportingservices">
Microsoft SQL Server Reporting Services
</ProductName>
<ProductVersion xmlns="http://www.microsoft.com/sql/reportingservices">11.0.5058.0</ProductVersion>
<ProductLocaleId xmlns="http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId>
<OperatingSystem xmlns="http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem>
<CountryLocaleId xmlns="http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId>
<MoreInformation xmlns="http://www.microsoft.com/sql/reportingservices"><Source>Microsoft.ReportingServices.ProcessingCore</Source>
<Message msrs:ErrorCode="rsReportParameterProcessingError" msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsReportParameterProcessingError&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=11.0.5058.0" xmlns:msrs="http://www.microsoft.com/sql/reportingservices">Error during processing of ‘paraDepot’ report parameter.</Message>
</MoreInformation>
<Warnings xmlns="http://www.microsoft.com/sql/reportingservices"/>

最好的祝福

 protected ParameterValue[] ReportPrameters;

   private void GetPDFByteStreamFromService()
            {
                var execHeader = new ExecutionHeader();
                var deviceInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

                var reportService = new ReportExecutionService()
                {
                    Credentials = CredentialCache.DefaultCredentials,
                    Url = ConfigurationManager.AppSettings.Get("ServiceURL"),
                    Timeout = System.Threading.Timeout.Infinite
                };

                reportService.ExecutionHeaderValue = execHeader;
                reportService.LoadReport(ReportPathInSSRS(), null);

                SetReportParameter();

                reportService.SetExecutionParameters(ReportPrameters, "en-us");

                try
                {
                    const string reportFormat = "PDF";

                    CurrentStatement.StatementsPDFBytes = reportService.Render(reportFormat, deviceInfo, out string extension, out string mimeType,
                        out string encoding, out Warning[] warnings, out string[] streamIDs);
                }
                catch (SoapException ex)
                {
                    Log.Error($"GetPDFByteStreamFromService SoapExcetpion: {ex.Message}", ex);
                    throw new Exception($"Error generating PDF Report");
                }
            }

public virtual void SetReportParameter()
        {

            ReportPrameters = new ParameterValue[3];
            ReportPrameters[0] = new ParameterValue()
            {
                Name = "Param1",
                Value = "1"
            };

            ReportPrameters[1] = new ParameterValue()
            {
                Name = "Param2",
                Value = "false"
            };

            ReportPrameters[2] = new ParameterValue()
            {
                Name = "Code",
                Value = "XYZ"
            };

            return;
        }

好吧,我終於敢了。 我將新報告重命名為舊的文件名,而我已經覆蓋了原來的文件名。 存儲在服務器上的數據集連接已保留,現在可以使用。

現在,原來的問題已解決,但我想知道為什么我不能在新上傳的文件上存儲數據源連接。

我知道了。

https://social.msdn.microsoft.com/Forums/sqlserver/zh-CN/4433567b-76d4-4864-b444-f57edf7efb14/rsaccessdenied-sql-server-2012-reporting-services?forum=sqlreportingservices

如果我必須上傳一次第二次報告,那么我會迷路。 現在,我可以忍受這一點,並希望沒有人意外破壞設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM