none
Access to the port 'COM1' is denied RRS feed

  • 问题

  • Hi, there;
    I am not sure if this is the right forum to ask this question. Sad

    I am doing a C# project which handles data (Weight, Length, Width, Height) from a scale through COM1. (C# 2.0, SerialPort object, WinXP).

    The scale is connected with COM1, and now I got exception "Access to the port 'COM1' is denied". My Keyboard,

     mouse and scanner are all USB port.

    Can anybody there give me some clue that what causes it and how to fix this problem?


    Cheers.
    The COM1 is definitely working. User has measured hundreds of items and got data back from scale.

    What I am doing here is to handle some exception happened to the serial port:
    1. Serial port is closed before sending data to COM1 (From application). Easy to handle.
    2. Serial port is closed when application is sending data to scale. Oooops.
    3. Serial port is closed before scale sending data back. Ooooooops.
    4. Serail port is closed in the middle of scale send data back. Oooooooops.

    The probelm is there is no "Closed" event to catch. (I am using .NET2, C#, SerialPort object)
    Yes, The COM1 is definitely working. User has measured hundreds of items and got data back from scale.

    What I am doing here is to handle some exception happened to the serial port:
    1. Serial port is closed before sending data to COM1 (From application). Easy to handle.
    2. Serial port is closed when application is sending data to scale. Oooops.
    3. Serial port is closed before scale sending data back. Ooooooops.
    4. Serail port is closed in the middle of scale send data back. Oooooooops.

    The probelm is there is no "Closed" event to catch. (I am using .NET2, C#, SerialPort object)

    What I found is that when my free WiFi is reconnecting, that COM1 will be disconnected. (WiF is used to send data to ser
    2010年5月19日 9:17

答案

  • Hi!

    I have same problem several days ago: connected with COM1,but got exception "Access to the port 'COM1' is denied".

    My problem is that the COM1 is opened by another application(another failed instance but ddid not close the port).

    I restart my computer, fixed my code. then problem is solved.

    • 已建议为答案 ZhileiModerator 2011年3月11日 2:32
    • 已标记为答案 紫柔 2011年3月15日 4:54
    2010年9月16日 5:30