C# 请求期间WCF的System.OutOfMemoryException

C# 请求期间WCF的System.OutOfMemoryException,c#,.net,wcf,.net-3.5,C#,.net,Wcf,.net 3.5,据我所知,我有一台服务器在请求期间的数据传输过程中抛出System.OutOfMemoryException。从这个轨迹来看,我的假设正确吗 System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult) at

据我所知,我有一台服务器在请求期间的数据传输过程中抛出System.OutOfMemoryException。从这个轨迹来看,我的假设正确吗

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
  at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
  at System.Net.Security.NegotiateStream.AuthenticateAsServer(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
  at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
  at System.ServiceModel.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgrade(Stream stream)
  at System.ServiceModel.Channels.InitialServerConnectionReader.UpgradeConnection(IConnection connection, StreamUpgradeAcceptor upgradeAcceptor, IDefaultCommunicationTimeouts defaultTimeouts)
  at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
  at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
  at System.ServiceModel.Channels.CommunicationObject.Open()
  at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump()
  at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump(Object state)
  at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()
  at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.OnSecurityContextCallback(Object o)
  at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
  at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()
  at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()
  at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
  at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
  at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
  at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

配置文件中的maxArrayLength和maxStringContentLength设置得非常高。是否有可能其中一个异常巨大,导致通道抛出此错误?这是一个.NET WCF服务,正在通过IPC与另一个进程进行本地通信。

鉴于这是一个生产问题,并且偶尔会发生在不同的地方,我猜您的内存利用率很高。我将获取系统的内存转储,并使用WinDbg查看是什么导致了这种情况

您可以使用或来执行此操作(但请确保根据需要使用32位或64位)


如果你以前从未对内存进行过分析(这真的不容易),那么你可能想看看什么是
真正的高
,你知道有一个最大限制。你发送的负载有多大?这是零星的还是特定的消息导致的?我发送一份基于员工浏览的报告摘要,因此,这取决于该组织有多少员工。摘要包含作为通用哈希集访问的页面的URL,这就是为什么我突然想到maxArrayLength和maxStringContentLength。使用querystring,hashset可以多次包含同一个页面,只是使用不同的查询字符串值。但除此之外,我有点不知所措。这个特定的客户是巨大的,所以我不会怀疑摘要是否大于50MB。@Conrad它是零星的,甚至有时它似乎是在跟踪的早期抛出的(我最早看到它是在ServerFramingDuplexSessionChannel.OnOpen上抛出的)