访问被拒绝的串口 [英] Access denied serial port

查看:144
本文介绍了访问被拒绝的串口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在C#,dot net中开发并执行了串口通信。



我的代码在所有串口都能正常工作,除非我连接加密狗(TATA PHOTON)并断开连接。然后,如果我执行我的串口代码,我收到异常,因为拒绝访问请告知此事。加密狗正确断开连接。在此先感谢。

解决方案

检查您的代码:它可能没有注意到断开连接,并且已经打开了SerialPort实例。如果你这样做,尝试连接一个新的将失败,因为端口正在使用。



确保当它断开连接时,你关闭并处置任何现有的实例

I have developed and executed serial port communication in C#, dot net.

My code is working fine with all serial ports in the lap, Unless I connect dongle (TATA PHOTON) and disconnect it. Then if I execute my serial port code I am receiving exception as "Access denied" Kindly advise on this. Dongle is disconnected properly. Thanks in advance.

解决方案

Check your code: the chances are it hasn't noticed the disconnect, and has left the SerialPort instance open. If you do that, trying to connect a new one will fail because the port is in use.

Make sure that when it disconnects, you close and dispose any existing instances.


这篇关于访问被拒绝的串口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆