简体   繁体   English

错误:无法建立连接,因为目标机器主动拒绝它

[英]Error: No connection could be made because the target machine actively refused it

i use this code for working with Port我使用此代码与 Port 一起工作

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/asynchronous-client-socket-example https://docs.microsoft.com/en-us/dotnet/framework/network-programming/asynchronous-client-socket-example

but I get the following error.但我收到以下错误。 No connection could be made because the target machine actively refused it.由于目标机器主动拒绝,无法建立连接。

在此处输入图像描述

Should I not connect(bind) the socket to the port?我不应该将套接字连接(绑定)到端口吗?

First we have to check whether the Database service or particular service is started or Dead position by using this command in linux terminal首先,我们必须在 linux 终端中使用此命令检查数据库服务或特定服务是否已启动或已死 position

  1. service database status (or) service service-name status服务数据库状态(或)服务服务名称状态

If particular service status is Dead or inactive then we have to start the service by using如果特定服务状态为 Dead 或 inactive 那么我们必须使用

  1. service service-name start服务服务名称开始

Then check the connection, it will connect Absolutely然后检查连接,它会连接 Absolutely

i changd code.我更改代码。

  Socket listener = new Socket(AddressFamily.InterNetwork,
                SocketType.Stream, ProtocolType.Tcp)

                listener.Bind(localEndPoint);
                listener.Listen(200);

worked.But I didn't understand why I had to do this?工作。但我不明白为什么我必须这样做?

There is no such thing in Microsoft's code.微软的代码中没有这样的东西。

暂无
暂无

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

相关问题 SignalR错误“由于目标机器主动拒绝连接,因此无法建立连接” - SignalR Error “No connection could be made because the target machine actively refused it” 收到错误消息“由于目标计算机主动拒绝连接而无法建立连接” - Geting Error “No connection could be made because the target machine actively refused it” 无法建立连接,因为目标计算机主动拒绝了它216.58.212.106:443 - No connection could be made because the target machine actively refused it 216.58.212.106:443 '由于目标机器主动拒绝它,因此无法建立连接 - 'No connection could be made because the target machine actively refused it 由于目标计算机主动拒绝连接,因此无法建立连接-客户端 - No connection could be made because the target machine actively refused it - client side 无法建立连接,因为目标计算机主动拒绝了127.0.0.1:8000 - No connection could be made because the target machine actively refused it 127.0.0.1:8000 由于目标计算机主动拒绝连接,因此无法建立连接-套接字程序 - No connection could be made because the target machine actively refused it - Socket Program 没有连接,因为目标机器主动拒绝它为什么? - No connection could be made because the target machine actively refused it why? “无法建立连接,因为目标机器主动拒绝它” Nethereum 异常 - “No connection could be made because the target machine actively refused it” Nethereum exception “无法建立连接,因为目标计算机主动拒绝了它” - “No connection could be made because the target machine actively refused it”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM