LINQ to SQL: intermittent AccessViolationException wrapped in TargetInvocationException(LINQ to SQL:TargetInvocationException 中包装的间歇性 AccessViolationException)
问题描述
几周以来,我们的 ASP.Net Web 应用程序遇到了 W3WP 崩溃问题.这些是在我们的网络服务器更新后开始的.我们的应用程序没有改变,并且多年来一直很稳定.
我们的情况似乎很像这个较早的问题.这个问题也可能是相关的,尽管在我们的例子中,查询在 99.9% 的使用时间内运行良好.
Since a few weeks we are experiencing W3WP-crashes with our ASP.Net web application. These started after our webservers were updated. Our application did not change and has been stable for years.
Our situation seems to be a lot like this earlier question. And this question might also be related, though in our case the queries run fine in 99.9% of the times used.
我们使用了大量未编译的 LINQ 查询,并尝试编译它们是否可以防止这些崩溃.崩溃的数量急剧减少,但它们仍然会发生.
We use a lot of uncompiled LINQ queries and tried if compiling them would prevent these crashes. The number of crashes decreased drastically, but they still do occur.
同样将我们的查询包装在 try catch
中,然后捕获 TargetInvocationException
也不起作用.未捕获异常.
Also wrapping our queries in a try catch
and then catching the TargetInvocationException
does not work. The exception is not caught.
发生崩溃时,我们会收到 WER 报告并可以检索崩溃转储.
来自未编译查询的转储的堆栈跟踪通常如下所示:
When a crash happens, we get a WER-report and can retreive a crash dump.
A stack trace from a dump for an uncompiled query typically looks like this:
在 System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(对象 obj,对象 [] 参数,对象 [] 参数)
在 System.Delegate.DynamicInvokeImpl(Object[] args)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInvocation(InvocationExpression 调用)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.Visit(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.VisitWhere(表达式序列,LambdaExpression 谓词)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.VisitWhere(表达式序列,LambdaExpression 谓词)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSelect(表达式序列,LambdaExpression 选择器)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.VisitDistinct(表达式序列)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(表达式节点)
在 System.Data.Linq.SqlClient.QueryConverter.ConvertOuter(表达式节点)
在 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(表达式查询,SqlNodeAnnotations 注释)
在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(表达式查询)
在 System.Data.Linq.DataQuery'1.System.Collections.Generic.IEnumerable.GetEnumerator()
在 System.Linq.Buffer'1..ctor(IEnumerable'1 源)
在 System.Linq.Enumerable.ToArray[TSource](IEnumerable'1 源)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Data.Linq.SqlClient.QueryConverter.VisitInvocation(InvocationExpression invoke)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
at System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
at System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.Visit(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.VisitWhere(Expression sequence, LambdaExpression predicate)
at System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.VisitWhere(Expression sequence, LambdaExpression predicate)
at System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.VisitSelect(Expression sequence, LambdaExpression selector)
at System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.VisitDistinct(Expression sequence)
at System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
at System.Data.Linq.SqlClient.QueryConverter.ConvertOuter(Expression node)
at System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataQuery'1.System.Collections.Generic.IEnumerable.GetEnumerator()
at System.Linq.Buffer'1..ctor(IEnumerable'1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable'1 source)
已编译查询的转储中的堆栈跟踪如下所示:
The stack trace from a dump for a compiled query looks like:
在 System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
在 System.Delegate.DynamicInvokeImpl(System.Object[])
在 System.Data.Linq.SqlClient.SqlProvider.AssignParameters(System.Data.Common.DbCommand, System.Collections.ObjectModel.ReadOnlyCollection`1, System.Object[], System.Object)
在 System.Data.Linq.SqlClient.SqlProvider.Execute(System.Linq.Expressions.Expression,QueryInfo,System.Data.Linq.SqlClient.IObjectReaderFactory,System.Object[],System.Object[],System.Data.Linq.SqlClient.ICompiledSubQuery[], System.Object)
在 System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(System.Linq.Expressions.Expression,QueryInfo[],System.Data.Linq.SqlClient.IObjectReaderFactory,System.Object[],System.Data.Linq.SqlClient.ICompiledSubQuery[])
在 System.Data.Linq.SqlClient.SqlProvider+CompiledQuery.Execute(System.Data.Linq.Provider.IProvider, System.Object[])
在 System.Data.Linq.CompiledQuery.ExecuteQuery(System.Data.Linq.DataContext, System.Object[])
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Data.Linq.SqlClient.SqlProvider.AssignParameters(System.Data.Common.DbCommand, System.Collections.ObjectModel.ReadOnlyCollection`1, System.Object[], System.Object)
at System.Data.Linq.SqlClient.SqlProvider.Execute(System.Linq.Expressions.Expression, QueryInfo, System.Data.Linq.SqlClient.IObjectReaderFactory, System.Object[], System.Object[], System.Data.Linq.SqlClient.ICompiledSubQuery[], System.Object)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(System.Linq.Expressions.Expression, QueryInfo[], System.Data.Linq.SqlClient.IObjectReaderFactory, System.Object[], System.Data.Linq.SqlClient.ICompiledSubQuery[])
at System.Data.Linq.SqlClient.SqlProvider+CompiledQuery.Execute(System.Data.Linq.Provider.IProvider, System.Object[])
at System.Data.Linq.CompiledQuery.ExecuteQuery(System.Data.Linq.DataContext, System.Object[])
有谁知道是什么改变了我们的应用程序的行为?我们知道这是一次更新"(但不完全是哪一次),但我们更感兴趣的是它的技术背景.
当然,我们也欢迎提供防止我们的应用程序崩溃的解决方案.
Does anyone know what might have changed the behavior our application? We know it was "an update" (but not exactly which one), but we are more interested in it's technical background.
Of course, we would also welcome a solution to prevent our application from crashing.
推荐答案
我想我会发布一个解决方案,我们发现了这个问题,因为我们最近开始遇到这个问题.
I thought I would post a solution, that we found to this issue, because we started experiencing the problem recently.
我们有许多服务器可以正常运行我们的代码,但只有 1 台每周因此错误而崩溃几次.我相信此服务器位于 .net 4.5.2 上.
We have many servers that run our code just fine but only 1 was crashing a couple of times a week with this error. I believe this server was on .net 4.5.2.
我们向 Microsoft 开了一张票,因为未处理的异常发生在他们的堆栈中.
We opened a ticket with Microsoft since the unhandled exception was happening in their stack.
他们查看了我们的转储并返回了这个可行的解决方案.
They looked at our dump and came back with this solution which worked.
一个新的修复是可用的https://support.microsoft.com/en-us/kb/3139544
如果你迁移到 .net 4.6.1 会更好
It would be better if you move to .net 4.6.1
我希望这个解决方案能帮助其他发现自己正在阅读本文的人.
I hope this solution will help anyone else that finds themselves reading this.
这篇关于LINQ to SQL:TargetInvocationException 中包装的间歇性 AccessViolationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:LINQ to SQL:TargetInvocationException 中包装的间歇性 AccessViolationException
基础教程推荐
- c# Math.Sqrt 实现 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30