2012-06-06 58 views
3

我使用SSRS 2008(NOT R2)SSRS 2008年执行服务LoadReport错误

我已经部署到开发服务器的报告,我试图通过调用执行服务呈现报表为PDF。

我得到的错误是 在纯模式下运行的报表服务器上不支持此操作。 ---> Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedNativeModeException:此操作在以纯模式运行的报表服务器上不受支持。

我注意到两件事:一个是web服务wsdl显示LoadReport有两个参数 - 报告路径和历史id,但是当我生成ReportExecution2005.asmx的服务引用时,LoadReport方法有5个参数:trusteduserheader,reportPath ?,historyid,serviceinfoheader和executionheader

我曾尝试与不添加服务引用WSDL在URL的末尾,但结果是一样的

下面是我使用的代码:

ReportExecutionServiceSoapClient rs = new ReportExecutionServiceSoapClient("ReportExecutionServiceSoap", "http://xxx:80/ReportServer/ReportExecution2005.asmx");    
     rs.ClientCredentials.Windows.ClientCredential = new NetworkCredential("aaa", "aaa", "aaa"); 

     rs.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; 



// Render arguments 

    byte[] result = null; 
    string reportPath = "/Invoices/InvoiceStandard"; 
    string format = "PDF"; 
    string historyID = null; 
    string devInfo = ""; 

    // Prepare report parameter. 

    ParameterValue[] parameters = new ParameterValue[3]; 

    parameters[0] = new ParameterValue(); 
    parameters[0].Name = "PartyID"; 
    parameters[0].Value = "19758"; 
    parameters[1] = new ParameterValue(); 
    parameters[1].Name = "Contract"; 
    parameters[1].Value = "17703"; // June 
    parameters[2] = new ParameterValue(); 
    parameters[2].Name = "FinancialPeriod"; 
    parameters[2].Value = "MAR-2012"; 
    string encoding=""; 
    string mimeType=""; 
    string extension=""; 
    Warning[] warnings = null; 
    string[] streamIDs = null; 

    ExecutionInfo execInfo = new ExecutionInfo(); 
    TrustedUserHeader trusteduserHeader = new TrustedUserHeader(); 
    ExecutionHeader execHeader = new ExecutionHeader(); 
    ServerInfoHeader serviceInfo = new ServerInfoHeader(); 


    execHeader = rs.LoadReport(trusteduserHeader, reportPath, historyID, out serviceInfo, out execInfo); 

    rs.SetExecutionParameters(execHeader, trusteduserHeader, parameters, "en-us", out execInfo); 

    try 
    {     
     rs.Render(execHeader, 
        trusteduserHeader, 
        format, 
        devInfo, 
        out result, 
        out extension, 
        out encoding, 
        out mimeType, 
        out warnings, 
        out streamIDs); 
    } 

这里是我的web.config

<?xml version="1.0"?> 
<configuration> 
    <connectionStrings> 
    <add name="ApplicationServices" 
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" 
     providerName="System.Data.SqlClient" /> 
    </connectionStrings> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 

    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> 
    </authentication> 

    <membership> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" 
      enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" 
      maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" 
      applicationName="/" /> 
     </providers> 
    </membership> 

    <profile> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> 
     </providers> 
    </profile> 

    <roleManager enabled="false"> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> 
     <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> 
     </providers> 
    </roleManager> 

    </system.web> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="ReportExecutionServiceSoap" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows"/> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://xxx:80/ReportServer/ReportExecution2005.asmx" 
     binding="basicHttpBinding" bindingConfiguration="ReportExecutionServiceSoap" 
     contract="SSRS.ReportExecutionServiceSoap" name="ReportExecutionServiceSoap" /> 
    </client> 
    </system.serviceModel> 
</configuration> 

回答

0

从一些前端加载该报告,或者从DLL加载?对我来说,看起来你正在使用ASP.net应用程序。在这种情况下,你可以使用的ReportViewer对象拉你所有繁重的任务可以通过的ReportViewer来完成的报告,你就可以只用这样

reportViewer.ServerReport.ReportServerUrl = new Uri(Config.ReportServerURL); 
reportViewer.ServerReport.ReportPath = String.Format("{0}/{1}", Config.ReportServerEnvironment, reportName); 
reportViewer.ServerReport.ReportServerCredentials = new ReportsCredentials(Config.ReportServerUser, Config.ReportServerPassword, Config.ReportServerDomain); 

reportViewer.GetDocumentStream(SSRSFormatType.Pdf, documentName); 

这里的ReportViewer东西是将文件保存为PDF 在屏幕上引用ReportViewer对象。

+0

其实这就是我最终做的 - 感谢Bhupendra! –

1

我与SSRS 2008 R2有同样的问题,但我不想诉诸调用报表查看器控件。

以上,里克·霍德是使用下面的语句:

TrustedUserHeader trusteduserHeader = new TrustedUserHeader(); 

这个语句让他遇到,如果SSRS安装不是SSL连接的证书配置的OperationNotSupportedNativeModeException错误。检查SSRS日志为包含错误项:

ERROR: TrustedHeader Not Supported in Native Mode.

如果是这样的话,你需要或者configure the server to work with SSL,或者使用无效的信任头部。

TrustedUserHeader trusteduserHeader = null;