zoukankan      html  css  js  c++  java
  • .Net Remoting中Remote Server的Port占用/释放问题

    这一问题一般出现在Console application/Windows Service承载Remote Objects时,要求Remote Server指定特定portIIS在承载Remote Objects并不需要指定特定port,因此一般不会出现SocketException异常信息。

     

    1. 启动承载Remote ObjectsConsole application,发现指定的port状态为:LISTENING

    显然Remote Server开始监听该port,可以接受Client端的请求。

     

    2. 在关闭承载Remote ObjectsConsole application后,发现指定的port状态为:TIME_WAIT

     

    如果现在启动该Console application,就会抛出如下异常:

    An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll

     

    Additional information: Remoting configuration failed with the exception System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port)

    is normally permitted

     

    SocketException异常:每一个socket address (protocol/network address/port)只能有一个使用。

     

    3. 个人观点

    关于TIME_WAIT状态,这是windows系统设计的,防止来自旧的连接(old connection)的剩余packets干扰新的连接(new connection)。因此,默认会等待4分钟,让那些剩余的packets丢弃掉。

     

    因此,不要试图去解决这一问题。等待4分钟左右的时间,确认该port确定已释放,再启动Remote Server,如Console application/Windows Service等。

     

    不同观点或意见,请发表评论或指出。谢谢。

  • 相关阅读:
    Mathematica 计算矩阵的伴随矩阵
    教你如何在word中像LaTex那样打出漂亮的数学公式
    中国科学院大学2016年硕转博考试试题
    161024解答
    161023解答
    161020-1解答
    关于查询扩展版ESI高被引论文的说明
    [Tex学习笔记]让项目编号从4开始
    [Tex学习]WinEdit 常用软件快捷键
    最著名的数学家一般也是最著名的力学家
  • 原文地址:https://www.cnblogs.com/rickie/p/51984.html
Copyright © 2011-2022 走看看