Unity Container failed to resolve custom role provider

Posted by Community Admin on 04-Aug-2018 13:32

Unity Container failed to resolve custom role provider

All Replies

Posted by Community Admin on 25-Sep-2015 00:00

Hi,

We are experiencing a very strange behavior, we have our own custom provider which works correctly with the site, but, recently, after the synchronization,the destination site comes up with the following exception,

 
The type String cannot be constructed. You must configure the container to supply this value. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.InvalidOperationException: The type String cannot be constructed. You must configure the container to supply this value.

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 



[InvalidOperationException: The type String cannot be constructed. You must configure the container to supply this value.]
   Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor) +277
   Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) +485
   Telerik.Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434
   Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) +400
   Telerik.Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +222
   Telerik.Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434
   Telerik.Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) +318
   BuildUp_Telerik.Sitefinity.Security.RoleManager(IBuilderContext ) +220
   Telerik.Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +304
   Telerik.Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434
   Telerik.Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +440

[ResolutionFailedException: Resolution of the dependency failed, type = "Telerik.Sitefinity.Security.RoleManager", name = "CUSTOMROLEPROVIDER".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type String cannot be constructed. You must configure the container to supply this value.
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Telerik.Sitefinity.Security.RoleManager,CUSTOMROLEPROVIDER
  Resolving parameter "providerName" of constructor Telerik.Sitefinity.Security.RoleManager(System.String providerName, System.String transactionName)
    Resolving System.String,(none)
]
   Telerik.Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +546
   Telerik.Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides) +20
   Telerik.Microsoft.Practices.Unity.UnityContainerExtensions.Resolve(IUnityContainer container, String name, ResolverOverride[] overrides) +91
   Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +660
   Custom.Sitefinity.Web.SiteMap.CustomSiteMap.CustomSiteMap.IsAccessibleToUser(HttpContext context, SiteMapNode node) in c:\CDO\Sitefinity\Web.SiteMap\CustomSiteMap\CustomSiteMap.cs:174
   Custom.Sitefinity.Web.SiteMap.CustomSiteMap.CustomSiteMap.ReturnNodeIfAccessible(SiteMapNode node) in c:\CDO\Sitefinity\Web.SiteMap\CustomSiteMap\CustomSiteMap.cs:194
   Telerik.Sitefinity.Web.SiteMapBase.GetRootNodeCore(Boolean ifAccessible) +753
   System.Web.SiteMapProvider.get_RootNode() +21
   Custom.Components.Widgets.BreadcrumbWidget.Controls.Breadcrumb._generateHierarchy() in c:\CDO\Sitefinity\Widgets\BreadcrumbWidget\Controls\Breadcrumb.cs:179
   Custom.Components.Widgets.BreadcrumbWidget.Controls.Breadcrumb.OnLoad(EventArgs e) in c:\CDO\Sitefinity\Widgets\BreadcrumbWidget\Controls\Breadcrumb.cs:163
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.AddedControl(Control control, Int32 index) +257
   System.Web.UI.Control.EnsureChildControls() +189
   System.Web.UI.Control.PreRenderRecursiveInternal() +60
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297
 
This exception is raised when we call:

RoleManager rManager = RoleManager.GetManager("CUSTOMROLEPROVIDER");

in the sitemap widget.

However, after recycling the app pool, the site comes up correctly, and the role provider is working weel too.

 

Do any one have any idea on it?

Regards,

 

Jack

 

 

This thread is closed