Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem in accessing the COM port. "Access denied for COM1 "

Problem in accessing the COM port. "Access denied for COM1 "

Scheduled Pinned Locked Moved C#
comhardwarehelptutorialquestion
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pallaka
    wrote on last edited by
    #1

    I have a hardware connected to the usb which communicates by sending the data.When i will start the application and hardware as a fresh it will work fine.But when i will stop my hardware and run it again it will throw me a exception handle stating that the Access denied for COM1: as you dont have proper rights to the resource.But when i remove the USB plug and re connects my application to the hardware it will start working. Do anyone know how to reset or re intiallize or reconnect the usb to hardware programitically...?

    L 1 Reply Last reply
    0
    • P pallaka

      I have a hardware connected to the usb which communicates by sending the data.When i will start the application and hardware as a fresh it will work fine.But when i will stop my hardware and run it again it will throw me a exception handle stating that the Access denied for COM1: as you dont have proper rights to the resource.But when i remove the USB plug and re connects my application to the hardware it will start working. Do anyone know how to reset or re intiallize or reconnect the usb to hardware programitically...?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      How about closing it ? SerialPort serialPort = new SerialPort(...); serialPort.Open(); ... ... ... serialPort.Close(); // <- close the connection serialPort.Dispose(); // <- dispose resources in serialPort, use it if you close your application

      P 1 Reply Last reply
      0
      • L Lost User

        How about closing it ? SerialPort serialPort = new SerialPort(...); serialPort.Open(); ... ... ... serialPort.Close(); // <- close the connection serialPort.Dispose(); // <- dispose resources in serialPort, use it if you close your application

        P Offline
        P Offline
        pallaka
        wrote on last edited by
        #3

        I tried all the stuff u mentioned, but it didnt work.I need to unplug and plug again to make it work.So i am looking is there any way to unplug problematically.

        L 1 Reply Last reply
        0
        • P pallaka

          I tried all the stuff u mentioned, but it didnt work.I need to unplug and plug again to make it work.So i am looking is there any way to unplug problematically.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Probably you are using a thread, and the thread is still active ? You must end the thread. What happened if you close your application and start it again ?

          P 1 Reply Last reply
          0
          • L Lost User

            Probably you are using a thread, and the thread is still active ? You must end the thread. What happened if you close your application and start it again ?

            P Offline
            P Offline
            pallaka
            wrote on last edited by
            #5

            No I am not using any thread.Even i close and run the applicatio i face the same problem.As i mentioned i need to remove and place the cable again to re communicate the data.

            L 1 Reply Last reply
            0
            • P pallaka

              No I am not using any thread.Even i close and run the applicatio i face the same problem.As i mentioned i need to remove and place the cable again to re communicate the data.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              That means, there are something wrong with your USB-COM adapter. Try to install the newest driver. Probably it's a bug in driver.

              P 1 Reply Last reply
              0
              • L Lost User

                That means, there are something wrong with your USB-COM adapter. Try to install the newest driver. Probably it's a bug in driver.

                P Offline
                P Offline
                pallaka
                wrote on last edited by
                #7

                I have updated with the latest drivers and still i face the same issue. Unfortunately it is not working with any other hardware also.

                L 1 Reply Last reply
                0
                • P pallaka

                  I have updated with the latest drivers and still i face the same issue. Unfortunately it is not working with any other hardware also.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Check your system, probably there are some process that watch your COM Port. If you say "Unfortunately it is not working with any other hardware also", that means something wrong in your system. That's not .NET problem.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups