Error adding a new widget to our BlogEngine.NET server


if you use Twitter in any web you will probably have noticed that they have switched off the 1.0 API, you have to use the 1.1 version which is stricter over OAUTH. This meant the Twitter feeds into our blog server stopped working on the 10th of June. The old call of

did not work and just change 1 to 1.1 did not work.

So I decided to pull down a different widget for BlogEngine.NET to do the job, choosing Recent Tweets.

The Problem

However when I tried to access our root/parent blog site and go onto the customisation page to add the new widget I got

Ooops! An unexpected error has occurred.

This one’s down to me! Please accept my apologies for this – I’ll see to it that the developer responsible for this happening is given 20 lashes (but only after he or she has fixed this problem).

Error Details:

Url :
Raw Url : /blogs/admin/Extensions/default.cshtml
Message : Exception of type ‘System.Web.HttpUnhandledException’ was thrown.
Source : System.Web.WebPages
StackTrace : at System.Web.WebPages.WebPageHttpHandler.HandleError(Exception e)
at System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
TargetSite : Boolean HandleError(System.Exception)
Message : Item has already been added. Key in dictionary: ‘displayname’ Key being added: ‘displayname’

Looking at the discussion forums it seem be had some DB issues.

The Fix

I could see nobody with the same problems, so I pulled down the source code from Codeplex and had a look at the DBBlogProvider.cs (line 2350) where the error was reported. I think the issue is that when a blog site is set ‘Is for site aggregation’, as our root site where I needed to install the new widget is, the SQL query that generates the user profile list was not filtered by blog, so it saw duplicates.

I disabled ‘Is for site aggregation’ for our root blog and was then able to load the customisation page and add my widget.

Interestingly, I then switched back on ‘Is for site aggregation’ and all was still OK. I assume the act of opening the customisation page once fixes the problem.

Also worth noting ….

In case you had not seen it, I hadn’t, there is a patch for that fixes a problem that the slug (the url generate for a post) was not being done correctly, so multiple posts on the same day got group as one. This cause search and navigation issues. Worth installing this if you are likely to write more than one post on a blog a day.

Leave a Reply

Your email address will not be published. Required fields are marked *