1

(请注意,这不是第一次运行的唯一问题,每次都会发生这种情况)

我想知道是否有人遇到过以下情况。

我们创建了从 SSRS 实例生成报告的 ac# 应用程序。

当我在 SSRS 实例所在的服务器上运行此应用程序时,报告会在 +- 6 秒内生成。

当我从远程机器(相同的网络,只是与 SSRS 实例不同的电脑)运行完全相同的应用程序时,相同的报告需要 +- 18 秒。

使用的代码类似于

ServerReport report = new ServerReport();
report.ReportServerUrl = new System.Uri(reportSetup.ConnectionString);
report.ReportServerCredentials.NetworkCredentials = System.Net.CredentialCache.DefaultCredentials;
report.ReportPath = reportName;
report.SetParameters(reportParams);
byte[] bytes = report.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);

ServerReport来自哪里 Microsoft.Reporting.WinFormsC:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer\Microsoft.ReportViewer.WinForms.dll但也尝试了网络版本),其余的被声明为

Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
List<ReportParameter> reportParams

并且 reportSetup.ConnectionString 的形式是http://<server name>/ReportServer(这里的服务器名称是实际名称,但我也尝试过使用 IP)。

我对上述每个步骤进行了计时,anf 发现罪魁祸首在它设置参数的那一行。所以我将参数值存储在实际报告中的默认值中,并删除了该步骤。然后渲染只需要比以前更长的时间。

除此之外,我还尝试将 Reporting Service Configuration Manager 服务帐户从网络更改为本地帐户,并使用在配置文件 (rsreportserver.config) 中找到的身份验证设置C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer

最初的身份验证设置是

<Authentication>
    <AuthenticationTypes>
        <RSWindowsNegotiate/>
        <RSWindowsNTLM/>
    </AuthenticationTypes>
    <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
    <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario>
    <EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>

我从Reporting Services 中的身份验证类型中<RSWindowsNegotiate/>读取时删除了该行

RSWindows协商

RSWindowsNegotiate 指示报表服务器处理指定 Negotiate 的身份验证请求。协商首先尝试 Kerberos 身份验证,但如果 Active Directory 无法将客户端请求的票证授予报表服务器,则回退到 NTLM。仅当票证不可用时,协商才会退回到 NTLM。如果第一次尝试导致错误而不是丢失票证,则报表服务器不会进行第二次尝试。

但这没有帮助。

有人对如何更正代码或 SSRS 安装有任何想法吗?我希望应用程序位于与 SSRS 实例不同的服务器上。

4

1 回答 1

0

您可能不幸地将应用程序从睡眠中唤醒。出于某种原因,在空闲时间到期后将 ssrs 重新联机会在启动和加载环境的过程中对您造成不利影响。一旦应用程序重新上线,它就会以预期的方式处理请求。

如果您既可以唤醒问题,又可以通过创建每小时任务来轮询资源来使系统更具响应性。

  1. 在脚本文件夹中创建一个包含以下内容的 PowerShell 文件:

    $wc = New-Object system.net.webClient $username = 'ReportAdmin' $password = 'ReportAdmin' $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $密码 -AsPlainText -Force))

    $wc.Credentials = $cred
    $src = $wc.DownloadString(“http://<SSRSSERVERNAME>/SSRS/Pages/Folder.aspx”)
    
  2. 使用以下内容在脚本文件夹中创建一个批处理文件:

powershell -command "&'C:\\SRSWakeup.ps1'"

  1. 创建一个每小时运行一次并保持 ssrs 活动的作业。您可以通过保存并将此内容导入 Windows 任务管理器来执行此操作:(它将调用 .cmd 来调用 power shell 命令以保持 ssrs 活动。

     <?xml version="1.0" encoding="UTF-16"?> <Task version="1.2"
      xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">  
     <RegistrationInfo>
          <Date>2012-10-29T17:57:58.8640417</Date>
          <Author>SERVER\AdminAccount</Author>
         <Description>Wakes up Reporting services when the service shuts down</Description>   </RegistrationInfo>   <Triggers>
          <CalendarTrigger>
           <Repetition>
              <Interval>PT1H</Interval>
              <StopAtDurationEnd>false</StopAtDurationEnd>
            </Repetition>
            <StartBoundary>2012-11-01T21:06:52.4488088</StartBoundary>
            <Enabled>true</Enabled>
            <ScheduleByDay>
              <DaysInterval>1</DaysInterval>
            </ScheduleByDay>
        </CalendarTrigger>   </Triggers>   <Principals>
          <Principal id="Author">
            <UserId>SERVER\AdminUser</UserId>
            <LogonType>Password</LogonType>
            <RunLevel>LeastPrivilege</RunLevel>
          </Principal>   </Principals>   <Settings>
          <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
          <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
          <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
          <AllowHardTerminate>true</AllowHardTerminate>
          <StartWhenAvailable>true</StartWhenAvailable>
          <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
          <IdleSettings>
            <StopOnIdleEnd>true</StopOnIdleEnd>
            <RestartOnIdle>false</RestartOnIdle>
          </IdleSettings>
         <AllowStartOnDemand>true</AllowStartOnDemand>
          <Enabled>true</Enabled>
          <Hidden>false</Hidden>
          <RunOnlyIfIdle>false</RunOnlyIfIdle>
          <WakeToRun>false</WakeToRun>
          <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
          <Priority>7</Priority>   </Settings>   <Actions Context="Author">
          <Exec>
            <Command>C:\<ScriptFolder\wakeup.cmd</Command>
          </Exec>   </Actions> </Task>
    
于 2013-03-21T04:04:07.593 回答