User login error
We have a site set up to allow Active Directory users to log in via Sitefinity's Ldap Membership Provider API. Generally, this has been working as expected -- however, we are now having an issue with one particular user generating the following error when trying to log in:
[InvalidOperationException: Query execution found more than one element.]
Telerik.OpenAccess.Query.ExpressionExecution.PerformQuerySingle(ExpressionCutter cutter, MethodCallExpression mce, ChainedContext piece, QueryOptions options) +2316
Telerik.OpenAccess.Query.Piece`1.ExecuteSingle(Expression expression) +397
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +640
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
Telerik.Sitefinity.Data.Linq.OpenAccess.OpenAccessQueryProvider`2.Execute(Expression expression) +188
Telerik.Sitefinity.Data.Linq.OpenAccess.OpenAccessQueryProvider`2.System.Linq.IQueryProvider.Execute(Expression expression) +26
System.Linq.Queryable.SingleOrDefault(IQueryable`1 source) +378
Telerik.Sitefinity.Data.ContentLinks.ContentLinksManager.GetContentLink(Guid parentItemId, Type parentItemType, String propertyName) +86
Telerik.Sitefinity.Model.ContentLinks.ContentLinksPropertyDescriptor.GetValue(Object component) +240
Telerik.Sitefinity.Security.UserManager.GetCachedUserProfile(Guid userId) +1002
Telerik.Sitefinity.Services.SitefinityContextBase.get_BackendCulture() +332
Telerik.Sitefinity.Localization.Resource.GetString(ResourceDataProvider provider, String classId, ResourceProperty property, CultureInfo culture, Boolean falback) +125
Telerik.Sitefinity.Localization.GlobalResourceProvider.GetObject(String resourceKey, CultureInfo culture) +184
System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName) +31
ASP.loopwidgets_logincustomtemplate_ascx.__BuildControlUserName() +318
ASP.loopwidgets_logincustomtemplate_ascx.__BuildControlloginWidgetPanel() +180
ASP.loopwidgets_logincustomtemplate_ascx.__BuildControlTree(loopwidgets_logincustomtemplate_ascx __ctrl) +274
Telerik.Sitefinity.Web.UI.ControlUtilities.LoadControl(String virtualPath, Page page) +563
Telerik.Sitefinity.Web.UI.VirtualPathTemplate.InstantiateIn(Control container, PlaceHoldersCollection placeHolders) +160
Telerik.Sitefinity.Web.UI.SimpleView.CreateContainer(ITemplate template) +54
Telerik.Sitefinity.Web.UI.SimpleView.get_Container() +60
Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +62
System.Web.UI.Control.EnsureChildControls() +182
System.Web.UI.Control.PreRenderRecursiveInternal() +73
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Control.PreRenderRecursiveInternal() +240
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3914
In general, I understand that the issue is that more than one item is being returned in a query that expects only one element, and that it seems to be associated with the UserName control in the login template. But I'm not sure how to go about debugging this. The odd thing about this -- aside from the fact that it affects only this one particular user -- is that it only appears on the servers in our load balanced production environment. Our development and qa environments, which query the same ldap provider, do not have this issue. This leads me to think that there is some issue in the production version of the Sitefinity database, but I'm not sure where to look to debug this. Any suggestions would be appreciated!
Hi Joseph,
As you mentioned, the issue seems related to the production database, most probably some of the profiles.
You can try to restore the database from production to your local project and try to debug it by query the users and their profiles and check it will return more than one record.
I hope this information helps.
Regards,
Svetoslav Manchev
Telerik