CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

Disabling the SQL Reporting Services cache

SQL Reporting Services keeps a copy of every report rendered in its cache. Of course this is quite a performance boost when a lot of users request the same report over and over again. But in our case this cache turned against us. We have an ASP.NET app whose reports are included in the app as a bunch of links to the reporting server. The page assembles the URL with the parameters (more on that later) and redirects the user to the report. Every time the user opened a report she was confronted with the previous version rendered. Based on the previous parameters. Clicking the the RS toolbar's refresh button (NOT the browser's refresh button) led to the intended report.

You can configure the caching of reports in great detail. It's under the execution tab in the report manager.

But there is a little quirk in this. Even when you set the report to Render this report with the most recent data, the user is (in our scenario) still confronted with a cached copy. This is either a bug or a misunderstanding between me and RS, I've seen others. What helped me here was using the rs:ClearSession parameter. In our app this is now the base URL for a report.

protected string reportServer
{
    get
    {
        return System.Configuration.ConfigurationSettings.AppSettings["ReportServer"] + "{0}&rs:Parameters=false&rs:Command=Render&rs:ClearSession=true";
    }
}
 

The report name and parameters go into the {0}

To be continued.


Published Oct 05 2005, 02:46 PM by pvanooijen
Filed under:

Comments

pvanooijen said:

hi Mok,

it's an old post but my blog is alive :)

These settings worked in our scenario but we did experience more and even weirder caching issues with RS. In one case we uploaded new report defintions, did see the new reports in the reportmanager, but the clients kept seeing the old version for days and days. Up till now we havn't found out what or who to blame :/

RS is quite nice but does have its quirks. In case we find anything usefull I'll blog.

# April 19, 2006 9:58 AM

David McCarter said:

I tried your suggestion, but the report still does not refresh correctly. Any ideas why?
# June 22, 2006 3:52 PM

pvanooijen said:

David, I'm afraid not. We're also still seeing some unintended caches. Which show rows which were deleted from the DB days ago! Reproducable, for specific selections in the report. I wish I knew what's going on.
# June 23, 2006 5:17 AM

sinfulmonk said:

It works!!!  Excellent post. Thanks.
# June 26, 2006 9:56 PM

Bonginkosi Ngubane (GMSI) said:

it worked for me... dont know if its gonna work 4ever thou...

You are The Man..

# September 12, 2006 11:28 AM

Mathias said:

Found another aproach in a Google group: pass an additional parameter in the URL that changes everytime, like a random number or current datetime. Supposedly Reporting Services recognizes that there's a different parameter (even if the parameter is not actually used in the report) and refreshes the cache every time the report is loaded. Worked for us.

# November 28, 2006 10:27 AM

pvanooijen said:

Nice ! Good there is another way as my way did not work for evrybody :)

# November 28, 2006 1:41 PM

Maddog said:

Mathias, how did you get around having to add the dummy parameter to every report?  When I add a parameter with the current timestamp to my report URL I get back an error message from the RS engine saying an attempt was made to set a report parameter <parm omitted> that is not defined in this report.  I am not wanting to add a new parm to 300+ reports in our library.  Is there a way to force the RS engine to ignore unmatched parms?  

# December 13, 2006 12:52 PM

Ivan said:

We are using the tip about include:

&rs:Command=Render

&rs:ClearSession=true

&rc:Toolbar=true

&rcarameters=true

&rc:emissionTime=<TimeTicks>

Were &rc:emissionTime= is a parameter that we add with the time ticks (in JavaScript tt= new Date().getTime(), then our URL is different each time that the user invoke the call to the report:

http://[ReportServerName]/ReportServer/Pages/ReportViewer.aspx?/Reporting+Services+Tests%2fMyTestReport&rs:Command=Render&rs:ClearSession=true&rc:Toolbar=true&rcarameters=true&rc:emissionTime=1181917533962

Using the extra parameter &rc:emissionTime=<TimeTicks>, and the others that I have mentioned above, our reports are working properly and we have not more rsExecutionNotFound errors.

Thanks, and regards

Iván

# June 15, 2007 10:41 AM

anne said:

Where should i put the things below? Im using reporting services in windows application...

&rs:Command=Render

&rs:ClearSession=true

&rc:Toolbar=true

&rcarameters=true

&rc:emissionTime=<TimeTicks>

thanks...

# September 25, 2007 3:54 AM

Craig Mpofu said:

Hi Bonginkosi

What are your new contact detail.My email is craigkq@hotmail.co.uk

# November 22, 2007 9:18 AM

David Roys said:

Thanks for this post - you really helped me out of a tight spot and fixed my problem. I had a SharePoint site witha URL that was being built to render a report as PDF - but it wasn't picking up the latest report definition, until I added the &rs:ClearSession=true to my URL. Thanks Heaps!

# May 12, 2008 6:57 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

This Blog

Syndication

News