繁体   English   中英

仅在 Windows 7 上拒绝访问端口 COM

[英]access denied to the port COM just on windows 7

我用c#开发。 我想使用 com 端口,但在 Windows 7 上总是被拒绝。该端口在 Windows 8 和 8.1 上启用。 我使用串口转 USB 转换器 ATEN USB 转串口桥。

我得到了这个例外:

System.dll 中发生类型为“System.UnauthorizedAccessException”的未处理异常

附加信息:拒绝访问端口“COM10”。

我在项目开始时的代码中只打开了一次串行端口。 没有其他程序使用此端口。 我试图重新启动计算机并运行该程序。 我试图拔下并重新插入端口。 它必须起作用。

我尝试了 PortMon 来查找使用我的串行端口的内容。 PortMon 写“未连接”,然后我尝试使用 ProcessExplorer 来查找进程之间的串行。 我没有找到。

我该如何解决问题。 为什么总是在 Windows 7 上使用任何串行端口?

public App()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);


            SerialPort serialPort = new SerialPort
            {
                PortName = "COM10",
                BaudRate = 9600
            };


            bool a = serialPort.IsOpen;
            serialPort.Open(); //exception occours here
        }

在此处输入图片说明

尝试关闭传真服务,在 services.msc 中将其设置为手动

感谢汉斯的提示!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM