gpt4 book ai didi

c# - System.Data.Linq.dll 上的 stackoverflow 异常

转载 作者:太空宇宙 更新时间:2023-11-03 11:00:37 25 4
gpt4 key购买 nike

我最近在开发一个 asp.net 网络应用程序。使用 linq to sql ORM 到数据访问层 (DAL)。在我的查询的特定情况下,在 clr 级别面临 stackoverflow 异常。

我使用过滤器表达式生成器来获取我们向存储过程发送超过 1500 个参数的特定数据(例如加载具有特定条件的数据)。

注意:我们认为 RPC(远程过程调用)限制恰好是 2100sql server 默认设置中的参数。

但我不知道为什么我会遇到 stackoverflow 异常?有趣的是,这个问题只发生在 iis 上,而在 asp.net web 开发服务器上没有问题。

而且我几乎找出了由大量参数引起的问题。

我对帮助我的人表示感谢?

Exception Detail

 public List<HSEPersonnelComplexPaging> SelectHSEPersonnelPaging(PagingPropertiesDTO pagingProps, out int recCount)
{
using (HRPaidTimeOffDataContext db = new HRPaidTimeOffDataContext(DBHelper.GetConnectionString()))
{
Expression<Func<HSEPersonnelComplexPaging, bool>> expr =
PredicateBuilder.GetFilterExpression<HSEPersonnelComplexPaging>(pagingProps);
db.DeferredLoadingEnabled = false;

var items = from at in db.HSEPersonnels
where at.IsDeleted == false
select new HSEPersonnelComplexPaging
{
ID = at.HSEPersonnelId,
PersonnelyNo = at.PersonnelyNo,
Name = at.Name,
Family = at.Family,
BirthPlace = at.BirthPlace,
Birthdate = at.Birthdate,
Father = at.Father,
IdNo = at.IdNo,
NationalCode = at.NationalCode,
IsNotActive = at.IsNotActive,
IsDeleted = at.IsDeleted,
InsertDate = at.InsertDate,
UpdateDate = at.UpdateDate,
InsertENTUserAccountId = at.InsertENTUserAccountId

};
var result = items.Where(expr);
recCount = result.Count();
return
result.ApplySortExpression(pagingProps.SortSet).Skip(pagingProps.CurrentPageIndex *
pagingProps.CurrentPageSize).Take(
pagingProps.CurrentPageSize).ToList();
}

最佳答案

问题可能在于您正在构建的谓词。当您枚举表达式时(在调用 Count() 时),LINQ to SQL 将遍历表达式树以确定您要查询的内容。您是否有可能在某处创建循环引用?

关于c# - System.Data.Linq.dll 上的 stackoverflow 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17809026/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com