Sql Server Reporting Services Webservice 处理参数异常,在 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 作为报告参数。
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,让我们将其命名为 ReportV2013.rdl 而不是 Render 方法。
那么这种行为可能是由安装的库版本的不幸组合引起的吗? SSDT(SQL服务器数据工具)的版本重要吗?
另外,VS2015 和 VS2013 运行在不同的虚拟机上。那么,我必须检查哪些库的版本?
ReportService 调用:ReportServer/Reportexecution2005.asmx。
渲染方法使用 DevInfo 参数:@"False"
欢迎提出任何想法。
实际上,我担心不得不再次降级到 vs2013 并在 Reportfile 中重新进行升级,因为我已经花了大约 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&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsReportParameterProcessingError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&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&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsReportParameterProcessingError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&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;
}
好吧,我终于敢了。我将新报告重命名为旧文件名,并覆盖了原来的报告。存储在服务器上的数据集连接仍然存在,现在可以使用了。
现在原来的问题已经解决了,但我想知道为什么我不能在新上传的文件上存储数据源连接。
我明白了……就像
如果我必须上传一次第 2 份报告,那我就迷路了。现在我可以忍受这个,希望没有人意外破坏设置。
该错误可能是由于将 VS 2013 解决方案升级到 VS 2015 引起的。 在迁移期间,无法迁移 Report-Project,因此我不得不添加一个新的并将 Compatibility 设置为 "Sql Server 2008"。根据另一个线程,我将 Debug-Folder 中的 .rdl 文件部署到我们的 ReportServer,因为 SourceFile 仍然指向 2016。
在预览期间,通过组合框选择参数,用户在其中选择一个字符串,并提供一个 ID 作为报告参数。
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,让我们将其命名为 ReportV2013.rdl 而不是 Render 方法。
那么这种行为可能是由安装的库版本的不幸组合引起的吗? SSDT(SQL服务器数据工具)的版本重要吗?
另外,VS2015 和 VS2013 运行在不同的虚拟机上。那么,我必须检查哪些库的版本?
ReportService 调用:ReportServer/Reportexecution2005.asmx。 渲染方法使用 DevInfo 参数:@"False"
欢迎提出任何想法。 实际上,我担心不得不再次降级到 vs2013 并在 Reportfile 中重新进行升级,因为我已经花了大约 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&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsReportParameterProcessingError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&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&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsReportParameterProcessingError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&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;
}
好吧,我终于敢了。我将新报告重命名为旧文件名,并覆盖了原来的报告。存储在服务器上的数据集连接仍然存在,现在可以使用了。
现在原来的问题已经解决了,但我想知道为什么我不能在新上传的文件上存储数据源连接。
我明白了……就像
如果我必须上传一次第 2 份报告,那我就迷路了。现在我可以忍受这个,希望没有人意外破坏设置。