我正在用C#聊天,我收到了这个错误:
System.ServiceModel.EndpointNotFoundException:无法连接到http://localhost:9000/MyService。 TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:9000
以下是服务器的配置文件:
<?xml version="1.0" encoding="utf-8" ?><configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<services>
<service name="ChattingServer.ChattingService">
<endpoint address="net.tcp://localhost:9000/MyService"
binding="netTcpBinding" bindingConfiguration="" name="ChattingServiceEndPoint"
contract="ChattingInterfaces.IChattingService" />
</service>
</services>
</system.serviceModel>
这是针对客户端的:
<?xml version="1.0" encoding="utf-8" ?><configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:9000/MyService"
binding="netTcpBinding" bindingConfiguration="" contract="ChattingInterfaces.IChattingService"
name="ChattingServiceEndPoint" kind="" endpointConfiguration="" />
</client>
</system.serviceModel>
我尝试通过激活net.tcpListenerAdapter(Start-&gt; Service)来修复它,但什么都没发生。 谢谢。