Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...General ExceptionGeneral Exception
Previous
 
Next
New Post
6/27/2011 6:47 PM
 
Hi all,

I am having difficulties with one of my client's website. The website would sometimes go down and gave the following error message:
System.Exception: Unhandled Error: ---> System.TypeInitializationException: The type initializer for 'DotNetNuke.Security.Roles.RoleController' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item) at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item) at System.Collections.ObjectModel.Collection`1.Add(T item) at DotNetNuke.ComponentModel.SimpleContainer.AddBuilder(Type contractType, IComponentBuilder builder) at DotNetNuke.ComponentModel.SimpleContainer.RegisterComponentInstance(String name, Type contractType, Object instance) at DotNetNuke.ComponentModel.AbstractContainer.RegisterComponentInstance[TContract](Object instance) at DotNetNuke.ComponentModel.ComponentFactory.RegisterComponentInstance[TContract](Object instance) at DotNetNuke.Security.Membership.DNNRoleProvider..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) at DotNetNuke.Framework.Reflection.CreateInstance(Type Type) at DotNetNuke.ComponentModel.SingletonComponentBuilder.CreateInstance() at DotNetNuke.ComponentModel.SingletonComponentBuilder.BuildComponent() at DotNetNuke.ComponentModel.SimpleContainer.GetComponent(IComponentBuilder builder) at DotNetNuke.ComponentModel.SimpleContainer.GetComponent(Type contractType) at DotNetNuke.ComponentModel.AbstractContainer.GetComponent[TContract]() at DotNetNuke.ComponentModel.ComponentFactory.GetComponent[TContract]() at DotNetNuke.Security.Roles.RoleProvider.Instance() at DotNetNuke.Security.Roles.RoleController..cctor() --- End of inner exception stack trace --- at DotNetNuke.Security.Roles.RoleController..ctor() at DotNetNuke.Entities.Portals.PortalInfo.get_AdministratorRoleName() at DotNetNuke.Entities.Portals.PortalSettings.GetPortalSettings(Int32 tabID, PortalInfo portal) at DotNetNuke.Entities.Portals.PortalSettings..ctor(Int32 tabID, PortalAliasInfo objPortalAliasInfo) at DotNetNuke.HttpModules.UrlRewriteModule.OnBeginRequest(Object s, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --- End of inner exception stack trace ---

The weird thing is that, it happens on weekends when the traffic is lower (one would expect it to happen on normal business days/hours). We have had this for the past few months and the only solution that could work with this is to restart the application/IIS.

The specs of the server/DNN:
1. DNN version is: 5.4.2
2. Site is self-hosted in their own facility. We have had some problems with the way their network is currently setup but not sure whether that might be the cause of the issue.

Things that we have tried to solve the problem:
1. Made sure there is no duplicate key in database, WebConfig.
2. Deleted the module cache from /Portals/0/module/cache/
3. Made sure the version of .NET (v. 3.5) framework is the same as what DNN requires
4. Made sure that there is no other application in the same Application Pool that uses older .NET framework

Any help is appreciated.

Heindy
 
New Post
6/29/2011 9:02 PM
 
I think throwing exception on weekend makes more sense. Since traffic is low, site has gone idle and IIS recycled it. And when somebody accesses it, code started to create singleton objects and then failed.
Few things you may want to check..
Since it is complaining about roles, check if there are duplicate roles in the table. If there is some user that has duplicate roles assigned to it. Last week some user account in our portals that had "Registered User" role assigned four times. Also from the stack trace identify the code block that is throwing the exception, copy that code in some stand alone app and see what is going on with that code which is causing duplicate keys.

I would be more than happy to offer my service in diagnosing this issue if above suggestions do not help.
 
New Post
8/2/2011 12:13 PM
 
It just happened again. @Byteblocks sorry I did not reply on time but I have done what you advised and still no result.

I don't know if this matters but in the server, there is another Virtual Directory within the website (IIS6). This application seems to be old and only using .NET 2.

Another note, the website is hosted internally and I know that their server is configured differently compared to others (we have had some DNS issues with it in the past).

I have installed a lot of DNN sites and have never come across this kind of problem. Is this something that DNN cause or the server itself?

Thanks.
 
New Post
8/2/2011 6:17 PM
 
There were a few race condition items that we fixed for 6.0 where duplicate/stale entries in collections (primarily lists and dictionaries) could have issues - though these typically only manifest on busy or resource constrained sites. This looks like it might be one (the "An item with the same key has already been added" message), so it might be worth considering upgrading -though perhaps wait a week or so for 6.0.1 (6.0 is pretty solid, but 6.0.1 fixes a bunch of issues)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
8/3/2011 4:52 PM
 
Hi Cathal,

Upgrading might be an option, however there are modules that I do not believe will be compatible with DNN 6 (i.e. Ultra Media Gallery). What do you think?

Heindy
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...General ExceptionGeneral Exception


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out