简体   繁体   English

'序列包含多个元素'错误

[英]'Sequence Contains More Than One Element' Error

Relatively new to working with .net but learning a lot while working with a developer at work who at times can be stubborn. 与.net合作相对较新,但在与工作中的开发人员合作时学习了很多,有时候他们很顽固。 Recently the asp.net web form we are developing has periodically started crashing such that every time a link is clicked that retrieves an object (an in process form that the user had previously filled out) the user gets the following application error: "Sequence contains more than one element." 最近我们正在开发的asp.net Web表单周期性地开始崩溃,每次点击一个链接来检索一个对象(用户以前填写过的进程中),用户就会收到以下应用程序错误:“Sequence contains不止一个元素。“

All the sources I looked at online suggested that this was an InvalidOperationException thrown by the Single method and could be avoided by (a) eliminating the source of duplicate elements or (b) using the First method instead of the Single method. 我在网上查看的所有资源都表明这是Single方法抛出的InvalidOperationException,可以通过(a)消除重复元素的来源或(b)使用First方法而不是Single方法来避免。

The developer told me that I had no idea what I was talking about and that this was a caching error that could only be solved via an IIS reset. 开发人员告诉我,我不知道我在说什么,这是一个缓存错误,只能通过IIS重置解决。 Since this has been happening periodically I'm a bit concerned that doing the IIS reset doesn't address the underlying issue that creates the exception. 由于这种情况已经定期发生,我有点担心IIS重置不会解决产生异常的根本问题。 Any one have any ideas? 有人有想法么? Is my developer right to say that an IIS reset is the best way to address this? 我的开发人员是否正确地说IIS重置是解决此问题的最佳方法?

Thanks! 谢谢!

According to me your developer might have used LINQ. 据我所知,您的开发人员可能使用过LINQ。 If he used single() or SingleOrDefault() or First() , tell him to replace those method with FirstorDefault() method. 如果他使用single()或SingleOrDefault()或First(),请告诉他用FirstorDefault()方法替换这些方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Web应用程序错误:序列包含多个元素 - Web Application Error: Sequence contains more than one element 序列包含多个元素 - Sequence contains more than one element InvalidOperationException:序列包含多个元素-SingleOrDefault() - InvalidOperationException: Sequence contains more than one element - SingleOrDefault() DotNetOpenAuth OpenID提供程序“序列包含多个元素” - DotNetOpenAuth OpenID Provider “Sequence contains more than one element” 序列在 ASP.NET MVC 中包含多个元素 - Sequence contains more than one element in ASP.NET MVC 序列包含多个元素(linq sum) - Sequence contains more than one element (linq sum) ASP.net Web API的ActionFilterAttribute引发InvalidOperationException:序列包含多个元素 - ASP.net Web API's ActionFilterAttribute throws InvalidOperationException: Sequence contains more than one element Asp.NET身份验证核心IsInRole InvalidOperationException:序列包含多个元素 - Asp.NET Identity Core IsInRole InvalidOperationException: Sequence contains more than one element ext:System.Exception:序列包含多个匹配元素 - ext : System.Exception: Sequence contains more than one matching element ASP.NETSequence包含多个元素 - ASP.NETSequence contains more than one element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM