This project is read-only.

Multiple Blog Caching Issues in v2.5

Topics: Business Logic Layer
Sep 30, 2011 at 7:38 PM
Edited Oct 1, 2011 at 4:04 AM

I'm seeing behavior in BlogEngine.Net v2.5 that I'm hoping someone can verify.  I have a multiple blog configuration and both the searching function and related posts control seem to be dysfunctional which I believe can be attributed to caching.

Both the Related Posts control and Searching form retrieve posts from the first blog loaded.  I had originally thought that non-primary blogs weren't being handled correctly, but I've done several tests and discovered that both functions use the posts of whatever blog was loaded into cache first on application start.

Can anyone confirm this?  I didn't see it listed in the Source Change Set Comments and found no other discussions referencing it.  

You can see what I'm describing in action at  Blogs are listed at [Updated. Wrong url originally posted:]  The primary News blog is most active and typically viewed/loaded before two other (somewhat neglected) lesser viewed blogs.  The Recent Posts control will retrieve posts from the News blog with links resulting in 404s.  The search function retrieves posts from the News blog and also spits out 404s.

Thanks much,


Oct 1, 2011 at 3:14 AM

Hi Dave -- I looked at the Recent Posts widget (widgets\RecentPosts) and the Recent Posts control (App_Code\Controls\RecentPosts.cs).  They both appear to take the current blog instance into consideration -- from what I can tell.

The Recent Posts control under App_Code maintains a "blogPosts" dictionary where the recent posts for each blog instance are maintained.   The Recent Posts widget is using the Blog.CurrentInstance.Cache mechanism to cache and retrieve the recent posts for the "current" blog instance.  In both cases, it will serve the recent post list based on the "current" blog instance.

On my local machine, I have BE running (a slightly newer version than the official  I just created a new blog instance and created a couple of test posts under it.  Both the primary instance and this new blog instance are using the Recent Posts widget.  On each blog instance, a separate list of Recent Posts are displaying.  So from what I can tell, the Recent Posts widget does appear to be "multiple blog aware".

I did try pulling up but am getting a YSOD error -- i.e. the typical "Runtime Error", please turn off customErrors to see the details ... so couldn't see the 404 errors.

Oct 1, 2011 at 3:50 AM

Ben, thanks for your reply and for investigating this!  So sorry for the YSOD!  I gave you the wrong URL!  It's if you'd still like to at least observe what I was describing on Recent Posts and Search in the "Business of Community" and "Discussion Roundup" blogs.  Please don't feel obligated to follow-up unless you'd like to.  

Thanks for the tip on the blogPosts dictionary.  I'll step through RecentPosts.cs and the BuiltResultSet() method in BE.Core/Search.cs some more.  If I find anything interesting I'll post back.

Best regards,

Oct 1, 2011 at 5:29 AM

I think you have found a problem.  The confusion here is that I think we've been mixing up terminology between "Recent" posts and "Related" posts (they sound similar!)

The Recent Posts widget/control looks to be okay.  But the Related Posts control is serving posts from other blogs -- depending on which blog loaded first, and also which blog most recently saved a Post, Page or Comment.

As you hinted, it's not the Related Posts control itself that is the problem, but the Search system which Related Posts relies on.  The Search system builds up a "Catalog" of all the posts/pages/comments tied to search terms.  It's *not* multiple blog aware and the Catalog is storing the items and keywords of either the first blog instance that loaded, or the blog instance that was most recently modified.

I should be able to put a fix in for this pretty soon.  Will post back here again when it's working.

Oct 1, 2011 at 7:41 AM

This is working now Dave.  It's checked in as  The only changes are in Search.cs in the BE core.  So you can either upgrade to, or just grab the latest Search.cs from

Sorry for the confusion there -- that was mostly my hastiness that lead to focusing on Recent Posts.  I'm glad you pointed this out though.  There were quite a lot of areas like this that needed to be modified to make BE be multi-blog aware for BE 2.5.  I thought we had them all, but apparently not.  Now we probably have it all covered -- unless you run into another spot like this!  (which is fine of course).

Oct 1, 2011 at 1:28 PM

Ben, you remain THE MAN!  Thanks.  Hey, I gave you the wrong Url so it's okay if you looked at the wrong control.

I'll definitely grab Search.cs and will be looking forward to learning how you handled this in the source.  

Thank you so much!

Dec 13, 2011 at 11:44 PM

My scenario is the following : 

  1. Hosting on winhost
  2. Multiple blogs on different host (domain pointers)
  3. blogengine latest release (
  4. create pages and welcome posts for main blog
  5. enter the blogs admin page and create all my blogs this way :
    a unique name , a unique storage 
    set the host as the domain pointer
    copy settings from main blog
  6. Check pages and posts in each blog : they are there in the control panel
  7. logout and visit each blog (with, etc)

Now i get one of the following results randomly:

1 - i can see pages in pagelist and the newly created blog is a clone of the main blog

2- the pagelist is empty but i can navigate the pages if i manually write the url


is it due to caching ?

is it a bug ?


if it was due to caching , how can i disable caching for testing-developing purpose ?

thanx for any direction in this, maybe i did not understand the software and i'm trying someting not supported ..