2016-03-15 89 views
0

我正在開發一個Windows服務,它使用service.create()方法讀取CSV文件並將記錄添加到Dynamics CRM 2011。它拋出以下異常,我一直無法確定原因:連接到Dynamics CRM拋出「請求被中止:請求被取消。」異常

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

你可以發佈你的代碼嗎?只有例外可能不足以解決問題。 – JanR

回答

0

您的問題很可能是由連接超時造成的。 對於異步操作,WCF不會在連接超時時拋出TimeoutException。相反,它會將CommunicationException與內部異常WebException與狀態WebExceptionStatus.RequestCanceled一起拋出。

響應超時爲同步和異步操作引發TimeoutException。

相關問題