尝试打开 TcpChannel 时出现错误 10048
我在远程处理方面非常缺乏经验.我正在尝试使用它并在打开 TcpChannel 时不断收到 WinSock 错误 10048.
I'm pretty inexperienced in Remoting. I'm trying to use it and keep receiving WinSock error 10048 when opening TcpChannel.
我使用 MSDN 中最简单的代码:
I use the simplest code from MSDN:
TcpChannel serverChannel = new TcpChannel(9090);
ChannelServices.RegisterChannel(serverChannel);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemoteObject), "RemoteObject.rem",
WellKnownObjectMode.Singleton);
第一次运行时,它可以正常工作并退出,但第二次等等我一直收到错误 10048,就像套接字 9090 已经在使用中一样.netstat -a 根本不显示端口 9090,就像它已经关闭一样.
When ran for the first time, it work and quit correctly, but for second and so on I keep receiving error 10048, like socket 9090 is already in use. Netstat -a do not show port 9090 at all, like it was closed already.
我做错了什么?
在问这里之前我已经花了四天时间试图解决这个问题,现在已经有了答案:只是 Windows XP 中的 WinSock 已损坏.
Prior to asking here I've spent four days trying to solve this, and already here's an answer: it's just WinSock in Windows XP was corrupted.
两个简单的 Windows 命令解决了这个问题:
Two simple Windows commands solved the problem:
netsh int ip reset resetlog.txt
netsh int ip reset resetlog.txt
netsh winsock 重置
netsh winsock reset