无法连接到net.tcp:// localhost:1234 [英] Could not connect to net.tcp://localhost:1234

查看:527
本文介绍了无法连接到net.tcp:// localhost:1234的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在c#中有一个简单的聊天程序,有一个客户端和一个服务器

当我启动程序时它给了我这个消息的警告:



附加信息:无法连接到net.tcp:// localhost:1234 / Chat / ChatService。连接尝试持续时间跨度为00:00:02.0986369。 TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:1234。



出了什么问题?

帮帮我

谢谢:)



这是一个代码:





Hi
I have a simple chat program in c# with a client and a server
when I start the program it give me warning with this message:

Additional information: Could not connect to net.tcp://localhost:1234/Chat/ChatService. The connection attempt lasted for a time span of 00:00:02.0986369. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:1234.

what's wrong?
help me
thanks :)

this is a code:


public void Start(ReceiveClient rc,string name)
        {
            inst = new InstanceContext(rc);
            chatClient = new ChatService.SendChatServiceClient(inst);
            chatClient.Start(name);
        }

推荐答案

Quote:

怎么了?



错误信息告诉你有什么问题


The error message tells you What is the problem

引用:

无法连接到net.tcp:// localhost:1234 / Chat / ChatService。

Could not connect to net.tcp://localhost:1234/Chat/ChatService.



以及为什么


and why

引用:

无法建立连接,因为目标计算机主动拒绝它127.0.0.1:1234。

No connection could be made because the target machine actively refused it 127.0.0.1:1234.





你有防火墙吗?

您是否允许您的程序通过tcp / ip端口与外部通信?特别是,是否允许收听端口?

您的操作系统是什么?



Do you have a firewall ?
Have you allowed your program to communicate with outside via a tcp/ip port ? Particularly, is it allowed to listen a port ?
What is your OS ?


这篇关于无法连接到net.tcp:// localhost:1234的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆