我正在使用Linq运行数据库第一个实体框架应用程序。某些查询我已经完美运行并返回正确的数据,但有些查询会返回:
A first chance exception of type 'System.AggregateException' occurred in mscorlib.dll System.AggregateException: One or more errors occurred. ---> System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs. at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.c__DisplayClass5`1.b__4(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
知道为什么会这样吗?它是否与返回的空数据相关联?如何找到有关此错误的更多信息?
以下是导致错误的查询之一:
var meetingDetails = ctx.MEETING.Join(ctx.MASTER.Where(i => i.STATUS == "CURRENT"
&& i.DOC_CLASS == "MEETING"),
i => new { i.REVISION, i.DOC_NUMBER },
d => new { d.REVISION, d.DOC_NUMBER },
(i, d) => new Meeting
{
Id = i.ID,
})
.OrderBy(x => x.StartDate)
.Distinct()
.FirstOrDefault();
答案 0 :(得分:0)
AggregateException
。因为您可以有多个并行任务,所有未处理的异常都会聚合到一个异常中。在聚合内部,您有FaultException
表示WCF错误。错误的描述是:
由于内部错误,服务器无法处理请求。有关错误的更多信息,请在服务器上启用IncludeExceptionDetailInFaults(来自ServiceBehaviorAttribute或配置行为),以便将异常信息发送回客户端,或者根据Microsoft .NET Framework SDK文档打开跟踪,检查服务器跟踪日志。
所以你有一个WCF错误,但你不知道服务器端发生了什么。您必须按照错误说明中提供的说明获取有关错误来源的更多详细信息。