使用remoting时候.客户端多网卡回调事件调用异常怎么解决?

javaoraspx 2014-05-09 10:18:15
主机只有一个网卡,客户机器多个网卡,服务器回调客户端时异常

发生了 System.Reflection.TargetInvocationException
Message=调用的目标发生了异常。
Source=mscorlib
StackTrace:
在 System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
在 System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
在 System.Delegate.DynamicInvokeImpl(Object[] args)
在 System.Delegate.DynamicInvoke(Object[] args)
在 Com.IComm.HLClientRegiste.hlDispatchMsg(clsUserInfo lgstatus) 位置 D:\Code\******\******\******\User\******.vb:行号 30
InnerException: System.Net.Sockets.SocketException
ErrorCode=10061
Message=由于目标机器积极拒绝,无法连接。 172.27.35.1:3057
NativeErrorCode=10061
Source=mscorlib
StackTrace:
Server stack trace:
在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
在 System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
在 System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
在 System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
在 System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
在 System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
在 System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
在 System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
在 System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 Com.IComm.clsbetween.hlDispatchMsg(clsUserInfo lgstatus)
InnerException:


注意是客户端多网卡 不是服务器

服务器配置:

服务端 ipconfig:

C:\Documents and Settings\****>ipconfig

Windows IP Configuration


Ethernet adapter 本地连接 2:

Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.2.133
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1



Dim serverProvider As New BinaryServerFormatterSinkProvider
Dim clientProvider As New BinaryClientFormatterSinkProvider()
serverProvider.TypeFilterLevel = TypeFilterLevel.Full
Dim props As IDictionary = New Hashtable()
props("port") = port
props("bindTo") = "192.168.2.133"
props("useIpAddress") = True
props("machineName") = "xxx.******" ' 这里填写后,在客户机器上面修改host
'props("rejectRemoteRequests") = False
RemotingConfiguration.CustomErrorsMode = False
Dim Tcp As New TcpChannel(props, clientProvider, serverProvider)
ChannelServices.RegisterChannel(Tcp, False)

服务端回调

Public Sub hlDispatchMsg(ByVal lgstatus As clsUserInfo)
If (Not IsNothing(hldir) AndAlso hldir.Count > 0) Then
Com.****.Util.PrintErrorHandle("客户端个数" & hldir.Count)
For i As Integer = hldir.Count - 1 To 0 Step -1
Dim ky As String = hldir.Keys(i)
Dim p As System.Delegate = hldir.Values(i)
Try
p.DynamicInvoke(lgstatus) '这里抛出上面的那个异常
Com.****.Util.PrintErrorHandle("分发" & ky)
Catch ex As Exception
hldir.Remove(ky)
Com.****.Util.PrintErrorHandle("异常" & ky)
Com.****.Util.PrintErrorHandle(ex.Message & vbCrLf & ex.StackTrace)
End Try
Next
End If
End Sub

网上查找的资料都是配置服务端的多个网卡,那怎么解决客户端多网卡,回调异常呢?
客户端是存在 ip: 172.27.35.1
...全文
192 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
beal_p 2014-05-09
  • 打赏
  • 举报
回复
友情回复下
javaoraspx 2014-05-09
  • 打赏
  • 举报
回复
....解决了...竟然没有回复..得了 解决问题: 客户端绑定ip

    Dim serverProvider As New BinaryServerFormatterSinkProvider()
        Dim clientProvider As New BinaryClientFormatterSinkProvider()
        serverProvider.TypeFilterLevel = TypeFilterLevel.Full
        Dim props As IDictionary = New Hashtable()

        props("port") = 0
        ' Dim ip As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName())
        'props("bindTo") = ip.AddressList(0).ToString
        props("bindTo") = ip
        MsgBox(ip)
        Dim Tcp As TcpChannel = New TcpChannel(props, clientProvider, serverProvider)
        ChannelServices.RegisterChannel(Tcp, False)

16,547

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧