【问题标题】:What is causing my intermittent System.Net.WebException errors?是什么导致我的间歇性 System.Net.WebException 错误?
【发布时间】:2013-02-15 23:22:53
【问题描述】:

我有一个应用程序,它使用 Microsoft Dynamics CRM 的 API 来插入和更新记录。每当我连续处理少量记录时,在尝试进行其中一项更新时都会遇到以下错误:

2013-02-14 10:25:56,382 - Updating lead in dynamics with leadid [3cdaa9d4-c276-e211-99b6-005056ab0822]
2013-02-14 10:25:58,737 - GetProperty
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.ConnectStream.WriteHeaders(Boolean async)
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Microsoft.Crm.SdkTypeProxy.Metadata.MetadataService.Execute(MetadataServiceRequest Request)
   at Integration.Crm.Services.Dynamics.LeadService.GetPickListvalue(String pickListlable, String logicalAttributeName) in C:\code\DynamicsIntegration\Services\LeadService.cs:line 1256

四处搜索,我发现了可能发生此特定错误 (System.IO.IOException: Authentication failed because the remote party has closed the transport stream.) 的一些原因,但在所有情况下,每次都发生这种错误,原因是配置错误或证书损坏。

到底有什么可能间歇性地触发这个错误?

它与网络请求的内容无关,因为我可以在 5 分钟后处理相同的请求并且它会起作用。对此服务器的所有请求大约 10% 的折扣会导致此错误。

编辑:这里有人使用 SharePoint,similar problem,但每次都发生错误。

【问题讨论】:

  • 什么版本的CRM?传输的数据块有多大?
  • 中间有什么东西(代理,防火墙,...)?
  • 您不是在多个线程之间共享上下文/ IOrganization Service 吗?
  • Microsoft Dynamics CRM 2011 (5.0.9690.2243)。两者之间有防火墙,但它是开放的(大多数情况下它是这样工作的)。 @Daryl:不。
  • @Rob 你解决过这个问题吗?我有完全相同的问题,几个星期没有解决方案。我的连接也有大约 10% 的时间间歇性关闭。事实上,我们的场景非常相似。您使用什么托管服务? link

标签: c# dynamics-crm-2011


【解决方案1】:

使用 CRM 诊断工具打开跟踪日志记录:http://crmdiagtool2011.codeplex.com 以查看您是否收到任何其他错误信息(假设您使用的是 On Premise)。我猜您从 CRM 服务器到 SQL 数据库的 SQL 连接有些地方不太对劲。

【讨论】:

  • 我会试试这个。谢谢达里尔。
  • 虽然我得到的错误似乎出现在网络层——在调用服务器和 CRM REST API 之间——而不是数据库层。
猜你喜欢
  • 2016-12-09
  • 1970-01-01
  • 2014-11-07
  • 2019-07-09
  • 2010-10-08
  • 1970-01-01
  • 2012-09-14
  • 2015-03-04
  • 1970-01-01
相关资源
最近更新 更多