我正在开发一种Windows服务,它使用service.create()
方法读取CSV文件并将记录添加到Dynamics CRM 2011。它引发了以下异常,我无法确定原因:
Exception Message: The request was aborted: The request was canceled.
Inner Exception:
Date Time: 3/14/2016 1:15:56 PM
Stack Trace: at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.Xml.XmlTextWriter.Flush()
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Serialize(SoapClientMessage message)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at myServ.CrmSdk.CrmService.Execute(Request Request)
at myServ.myServ.DeleteReceiptsByRecpDate(DateTime dtToday, String AbcAgency, CrmService service)
at myServ.myServ.timer1_Elapsed(Object sender, ElapsedEventArgs e)
答案 0 :(得分:0)
组织服务最终是一个WCF服务......你可以享受内部部署的好处,也许你发送的请求太大或者CRM很忙,无法回复你的请求在超时之前。
无论如何,您可能需要考虑增加Binding配置中的超时值。
https://msdn.microsoft.com/en-us/library/hh924831(v=vs.110).aspx
答案 1 :(得分:0)
您的问题可能是由连接超时引起的。 对于异步操作,WCF不会在连接超时时抛出TimeoutException。相反,它将使用Status WebExceptionStatus.RequestCanceled抛出具有内部异常WebException的CommunicationException。
响应超时对同步和异步操作抛出TimeoutException。