Socket#33711845::DoBind 中的异常 - 通常只允许每个套接字地址(协议/网络地址/端口)使用一次
我正在尝试设置一个简单的远程 Windows 服务,并在启动该服务时出现以下错误:
System.Net.Sockets Error: 0 : [4180] Exception in the Socket#33711845::DoBind - Only one usage of each socket address (protocol/network address/port) is normally permitted
System.Net.Sockets Verbose: 0 : [4180] ExclusiveTcpListener#4032828::Start()
System.Net.Sockets Verbose: 0 : [4180] Socket#33711845::Bind(0:9998#9998)
System.Net.Sockets Error: 0 : [4180] Exception in the Socket#33711845::DoBind - Only one usage of each socket address (protocol/network address/port) is normally permitted
在 Windows 服务应用程序中,我在“OnStart”方法中有以下代码 - 注册通道时发生错误 - ChannelServices.RegisterChannel( tcpPipe,真);据我所知,没有其他进程使用端口 9998 ...
protected override void OnStart(string[] args)
{
int portNumber = int.Parse(ConfigurationManager.AppSettings["endPointTCPPort"]);
TcpChannel tcpPipe = new TcpChannel(portNumber);
ChannelServices.RegisterChannel(tcpPipe, true);
Type serviceType = Type.GetType("TractionGatewayService.TractionGateway");
try
{
RemotingConfiguration.RegisterWellKnownServiceType(serviceType, "updateCustomerDetails", WellKnownObjectMode.SingleCall);
}
catch (RemotingException e)
{
EventLog.WriteEntry("unable to establish listening port because " + e.message;
ChannelServices.UnregisterChannel(tcpPipe);
}
I'm attempting to setup a simple remoting windows service and getting the following error when starting the service:
System.Net.Sockets Error: 0 : [4180] Exception in the Socket#33711845::DoBind - Only one usage of each socket address (protocol/network address/port) is normally permitted
System.Net.Sockets Verbose: 0 : [4180] ExclusiveTcpListener#4032828::Start()
System.Net.Sockets Verbose: 0 : [4180] Socket#33711845::Bind(0:9998#9998)
System.Net.Sockets Error: 0 : [4180] Exception in the Socket#33711845::DoBind - Only one usage of each socket address (protocol/network address/port) is normally permitted
In the windows service application I have the following code in the "OnStart" method - the error occurs when registering the Channel - ChannelServices.RegisterChannel(tcpPipe, true); As far as I can tell there are no other processes using port 9998 ...
protected override void OnStart(string[] args)
{
int portNumber = int.Parse(ConfigurationManager.AppSettings["endPointTCPPort"]);
TcpChannel tcpPipe = new TcpChannel(portNumber);
ChannelServices.RegisterChannel(tcpPipe, true);
Type serviceType = Type.GetType("TractionGatewayService.TractionGateway");
try
{
RemotingConfiguration.RegisterWellKnownServiceType(serviceType, "updateCustomerDetails", WellKnownObjectMode.SingleCall);
}
catch (RemotingException e)
{
EventLog.WriteEntry("unable to establish listening port because " + e.message;
ChannelServices.UnregisterChannel(tcpPipe);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经找到问题了。我对 TcpChannel 进行了两次单独的调用来注册端口 - 因此出现了错误。
感谢所有看过此内容的人。
...
I've found the problem. I had two seperate calls to TcpChannel to register the port - hence the error.
thanks to everyone who has taken a look at this.
...