16,547
社区成员
发帖
与我相关
我的任务
分享
发生了 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:
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
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)