我在Windows XP embadded版本上运行.net 3.5应用程序。此应用程序通过串行(COM)端口写入和读取一些数据。该应用程序可以在我的笔记本电脑(Windows XP Professional)上正常工作,但不适用于嵌入式Windows XP。我一直得到这个错误:Windows XP Embedded版本中System.IO.IOException的原因是什么?
System.IO.IOException: The I/O operation has been aborted because of either a thread exit or an application request.
什么可能是造成它?
一些额外的信息:阅读,我使用ReadExisting
而不是Readline
。另外在阅读之前,我要确保端口也是开放的。
System.IO.IOException: The I/O operation has been aborted because of either a thread exit or an application request.
at System.IO.Ports.SerialStream.EndRead(IAsyncResult asyncResult)
at System.IO.Ports.SerialStream.Read(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
at System.IO.Ports.SerialStream.Read(Byte[] array, Int32 offset, Int32 count)
at System.IO.Ports.SerialPort.ReadExisting()
at ScalesApp.Scales.handleDataReceived(Object sender, SerialDataReceivedEventArgs e)
at System.IO.Ports.SerialPort.CatchReceivedEvents(Object src, SerialDataReceivedEventArgs e)
at System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents(Object state)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
你能够使用其他应用程序(如超级终端)的串行端口吗? – Gabe 2009-07-28 16:02:13
是的,我可以。我应该提到这个问题,我的应用程序实际上可以通过串口进行通信,但一段时间后它会得到异常。 – Prithis 2009-07-28 16:12:38