我在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