an attempt was made to access a socket in a way forbbiden by its access permissions. why?

前端 未结 11 1141
北荒
北荒 2020-11-28 11:49
 private void StartReceivingData(string ipAddress, int iPort)
    {
        try
        {
            if (!_bContinueReciving)
            {
                //initia         


        
相关标签:
11条回答
  • 2020-11-28 12:16

    IIS was the main offender for me. My ISS was running and it restrains any new socket connections from opening. The problem resolved for me by stopping IIS by running the command "iisreset -stop"

    0 讨论(0)
  • 2020-11-28 12:20

    I've had this problem when trying to start a dotnet Core project using dotnet run when it tried to bind to the port.

    The problem was caused by having a Visual Studio 2017 instance running with the project open - I'd previously started the project via VS for debugging and it appears that it was holding on to the port, even though debugging had finished and the application appeared closed.

    Closing the Visual Studio instance and running "dotnet run" again solved the problem.

    0 讨论(0)
  • 2020-11-28 12:25

    I had a similar problem but I fixed it with by doing some changes in firewall setting.

    You can follow the below steps

    1. Go to "Start" --> "Control Panel"
    2. Click on "Windows Firewall"

    3. Inside Windows Firewall, click on "Allow a program or feature through Windows Firewall"

    4. Now inside of Allow Programs, Click on "Change Settings" button. Once you clicked on Change Settings button, the "Allow another program..." button gets enabled.

    5. Click on "Allow another program..." button , a new dialog box will be opened. Choose the programs or application for which you are getting the socket exception and click on "Add" button.

    6. Click OK, and restart your machine.

    7. Try to run your application (which has an exception) with administrative rights.

    I hope this helps.

    Peace,

    Sunny Makode

    0 讨论(0)
  • 2020-11-28 12:28

    Reload Visual Studio with Administrator privileges. Windows Sockets (WinSock) will not allow you to create a SocketType.RAW Socket without Local Admin. And remember that your Solution will need elevated privileges to run as expected!

    0 讨论(0)
  • 2020-11-28 12:28

    I'm developing an UWP application which connects to a MQTT broker in the LAN. I go a similar error.

    MQTTnet.Exceptions.MqttCommunicationException: 'An attempt was made to access a socket in a way forbidden by its access permissions [::ffff:xxx.xxx.xxx.xxx]:1883'
    
    ExtendedSocketException: An attempt was made to access a socket in a way forbidden by its access permissions [::ffff:xxx.xxx.xxx.xxx]:1883
    

    Turned out that I forgot to give the app the correct capabilites ...

    0 讨论(0)
提交回复
热议问题