all posts

System.NullReferenceException when starting Community Server News Gateway Windows Service

Published to Blog on 14 Feb 2008

Yesterday a colleague wrote, “It’s hard to believe you had 27 blog posts in one month a year ago.” I think that his disbelief was triggered by my lack of regular posts recently compared to my abundance of posts then. Last night I took a look back through some of those posts from this time last year to see what the heck I was doing that would give me enough material to post nearly once per day. One of the things I was working on was the WhatIWantMost project, but the other was that I had only months before joined the Telligent team and I was getting my first strong dose of Community Server. I had used CS for blogs long before that time so I was familiar with that side of the product, but I had only implemented CS forums once before that - and even then it was vanilla. Because I was new I had a lot of information that I could relay to other beginners.

Over the course of the past year I have gained more experience working with Community Server and have grown more comfortable with it. When an issue does come up it’s usually not “new” to me so I don’t feel that it’s worth blogging about. Yesterday I ran into something that I would have normally cast aside in the same manner, but I realize now that it is worth sharing.

I installed the Community Server News Gateway add-on to a new server and it seemed to be a successful installation. I updated the configuration files and dropped everything into place (I was copying from a known good installation on an existing server). I ran the console application and everything worked fine. However, when I tried to start the service it would immediately stop and show a generic message. In the Application Event Log I found something similar to this:

System.NullReferenceException: Object reference not set to an instance of an object.
at CommunityServer.NntpServer.Service.Program.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

Since the console app worked fine I assumed that there was nothing wrong with my configuration or with the program itself. I thought that there must be something wrong with the setup of the service. After searching through the forums I found a similar issue with a different service that had something to do with the registry key being stored in the wrong place.

The News Gateway service was expecting to find its registry entry at:
HKEY_LOCAL_MACHINE\SOFTWARE\Telligent Systems, Inc.\Community Server News Gateway
but mine had been installed at:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Telligent Systems, Inc.\Community Server News Gateway

The new web server that I was installing to was a 64-bit OS and I had chosen the default path that was presented to me when running the service’s installer so it was installed to the “Program Files (x86)” folder. I assume that is why it was put in the “Wow6432Node” rather than directly in the “SOFTWARE” node. Seems that the service could not find its registry entry which was why it was throwing the NullReferenceException.

The quick fix for me was to manually create a copy of the node (along with its keys and entries) directly in the “SOFTWARE” node. After that the service fired right up and ran properly.

Hopefully someone will find this information useful when happening upon this post while searching for the described exception. I’ll try to remember to keep posting bits like this as I encounter them.

Dan Hounshell
Web geek, nerd, amateur maker. Likes: apis, node, motorcycles, sports, chickens, watches, food, Nashville, Savannah, Cincinnati and family.
Dan Hounshell on Twitter

  • On 15 Feb 2008 "Ken Robertson"" said:
    Which version are you using? Think the dependence on the registry key was removed from CS 2007.1, for that very reason. It made xcopy deployment more difficult, and caused issues with 64-bit OSes since we had the registry path hard coded.
  • On 15 Feb 2008 """ said:
    Ken, thanks for the info. My original install was code from just prior to the 2007.1 release. I used the most recently released installer, but then copied my old dlls and configs from an existing server over top of what the installer put in place (thus reverting to pre-2007.1). It's good to know that it is no longer an issue. Thanks, Dan
  • On 24 Feb 2008 "External Feeds"" said:
    blog bits It appears that Microsoft is continuing to advance their social networking product, as it now
  • On 24 Feb 2008 "Community Blogs"" said:
    blog bits It appears that Microsoft is continuing to advance their social networking product, as it now
  • On 27 Feb 2008 "Dave Burke's Community Server Bits"" said:
    Dan Hounshell with one of those thousand-dollar posts if you happen to be experiencing a "System