1

我在生产中有一个例外,它没有产生任何日志内容。我们在这个 catch 块中记录了正常的生产错误,但是由于某种原因,这个特殊的异常(我不知道它是什么)没有记录任何东西。这是 catch 块:

//catch any exception and add it to the list of exceptions, and process next id
catch (Exception e)
{
    if (exceptionMessageBuilder.Length != 0)
    {
        exceptionMessageBuilder.AppendLine("----------------------------------------");
    }
    exceptionMessageBuilder.AppendFormat("Error occurred in processing id {0}.\n", currentID);
    exceptionMessageBuilder.AppendLine(e.ToString());
}

我得到的唯一输出是“处理 id d455e51f-6c86-4591-b75e-a2d29be73f4c 时发生错误。” 应用程序完成并将其作为电子邮件发送,因此它不会完全轰炸。

通常我会收到如下消息:

Error occurred in processing id 593abf56-5057-400e-bbfb-da819df59710.
System.ServiceModel.FaultException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

有什么理由我不会得到信息?是否可以捕获空异常?

4

0 回答 0