????? ????? ???? ??? ???? ???? ??? ?????? ???????? 2005 Visual Basic ?? Visual Basic .NET

?????? ????????? ?????? ?????????
???? ???????: 301112 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
?????? ??? ????? Microsoft Visual C# .NET ?? ??? ???????? ???? 307600.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ?????? ????? ????? ???? ??? ?????? ??? ???? ????. ??? ????? ???? ??? ?????? ??? ??????? ????? ???? ???? ???? ???? ?????? ?? ????? ??????? ??? ?????? ??? ??????. ?? ??? ??? ???? ??? ??????? ??? ?????? ??????. ?????? marshals ????? ??????? ??? ??????.

????? ??? ??????? ??? ????? ?????: ?????? ?????? ? ????? ???? ????? ??????. ????? ??? ?????? "????? ??????? ?? Microsoft" ???????:
300951????? ????? ???? ???? ???????? Visual Basic .NET
300943????? ????? ???? ?????? ????? ???? ???????? Visual Basic .NET

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • ?????? Microsoft Windows NT 4.0 ?? Microsoft Windows Server 2003 Microsoft Windows 2000 Professional Windows 2000 Server Windows 2000 Server? ??????
  • Microsoft Visual Studio 2005 ?? Microsoft Visual Studio .NET
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • Visual Studio 2005 ?? Visual Studio .NET
  • ???? ??????? ????????

????? ???? ???? ???? ?????? ????? ????????

?????? ?????? ?????? ????? ?????? ?? ????? ???? ??????. ???? ?????? ?? ?? ????? ?????? instantiates ???? ?? ??????? ??????. ???? ????? ?????? ???? ???? ???? ???? ???? ?? ?????? ??? ??????. ???? ?????? ??? ???????? ?? ????? ??? (DLL) ????? HelloServer. ?? ??? ??????? ???? ????? ??? ???????? ??? ????? ?? ?????? ??? ??????. ???? ????? ??? ????? ForwardMe. ???? ???? ??? ForwardMe ???? ????? ??? ?????? ??? ?? ??? ????? ForwardMe MarshalByRefObject.
  1. ??? ????? Visual Studio 2005 ?? Visual Studio .NET.
  2. ????? ????? ????? ??? ???? ?? ??? ServerClassRef.
  3. ????? ????? ????? Class1.vb ?? ServerClassRef.vb.
  4. ???? ServerClassRef.vb ?? ????? ????? ???? HelloServer ? ForwardMe ?????? ??? ?? MarshalByRefObject. ???? ??? HelloServer ????? ???????? ????????? ?? ??? ????? ??????. ???? ??????? ??? ForwardMe ????? ?????? ?????? ?? ?????? ??? ??????. ??? ?? ???? ????? ????????? ???????? ServerClassRef.vb ???????:
    Public Class HelloServer
    	Inherits MarshalByRefObject
    
    End Class
    Public Class ForwardMe
    	Inherits MarshalByRefObject
    
    End Class
    					
  5. ????? ????? ????? HelloServer ???? HelloMethod ???? ???? ForwardMe. ???? ??????? ??? ??????? ????? ???? ForwardMe ??? ??????. ??? ??????? ??? ??????? ??????? CallMe ??? ??????. ??? ????? ??????? HelloServer ?? ???? ???????:
    Public Class HelloServer
        Inherits MarshalByRefObject
    
        Public Sub HelloMethod(ByRef obj As ForwardMe)
            Dim i As Integer
            obj.CallMe()
        End Sub
    End Class
    					
  6. ????? ????? ????? ??? ??? ForwardMe. ????? ??? ??????? ??? ??? ??????? ???? ??? ????? ??? ????????? ????????. ???? ??? ??? ????? ??? ???? ??? ?????? ????? ?????? ??????????? ?????? (??????? ??? ??????), ????? ?????? ????????? ???????? ?? ????? ??????.
    Public Class ForwardMe
        Inherits MarshalByRefObject
    
        Public Function CallMe() As Object
            Console.WriteLine("CallMe was executed in: " & _
            Process.GetCurrentProcess.ProcessName.ToString)
        End Function
    
    End Class
    					
  7. ????? ????? ????? ????? ServerClassRef.dll.
  8. ???? ?? ??? ???????.

????? ????? ???? ??????

????? ????? ???? ???? ??? ???? ?????? ?? ??? ????? ??? ?????? ?? ???? ??? ??????? ?? ????. ????? ??? ??? ????? ????? ?????? ???? ????? ????? ??? ????? ?????? ?????? ???? ??????? ??? ???? ??????? ???????. ?????? ????? ????? ??? ??? ????? ???? ????? ??? ???? ???????. ?? ??? ????? ???? ?????? ?? ?????? ?????? ???? ???? ?????? ??????? ???? ???? ?? ??????. ????? ?? ??? ??????? ?? ?? ???? ?? ???? ???? ????? ????? ??? ????? DLL.
  1. ??? ????? Visual Studio 2005 ?? Visual Studio .NET.
  2. ????? ????? ???? ???? ???? ??? ????? ?????? ?????? ???????? ServerObjectRef sake ????? ???????.
  3. ????? ????? ????? ???? ?? ?????? ???? ??????? Module1.vb ServerObjectRef.vb.
  4. ????? ???? ??? ????? ????? System.Runtime.Remoting ??? ???????.
  5. ????? ???? ??? ???? ServerClassRef.dll ???? ??? ??????? ?? ?????? ??????.
  6. ?????? ????? ?????? ????????? ??? ?????? ????? ?? ???? ? Remoting.ChannelsRemoting.Channels.TCP ???? ?? ????? ??? ????? ????????? ?? ????? ??????? ?????? ?? ????????? ????????. ??? ??????? ???? ?????? ????????? ??? ?? ????????? ??????:
    Imports System.Runtime.Remoting
    Imports System.Runtime.Remoting.Channels
    Imports System.Runtime.Remoting.Channels.TCP
    					
  7. ????? ????? ????? ???? TcpChannel ??? ???????? ????? ??????? ??? ????? ???? ? ?? ??? ?????? ???? 8085. ????? ?????? ???? ????????? ?????? ??????? ?????? ?????? ?????? ??????? ??????? RegisterChannel. ????? ?????? ?????? ????? ?? ??????? ??????? ?? ?????? ??????? 1:
    Dim chan As TcpChannel = New TcpChannel(8085)
    ChannelServices.RegisterChannel(chan)
    					
  8. ????? ???? ServerClassRef ?? ???? ??? ??????? ?? ???? ?????? ??????? ??????? RegisterWellKnownType ?????? RemotingConfiguration. ??? ????? ??????? ???????:
    1. ??? ??? ?????? ?? ???? ??? ?????? ?? ??? ?????? ServerClassRef.HelloServer ???? ??? ??????? ServerClassRef. ??? ????? ??? ????? ????? ???????? ??? ??? ?????. ???? ?? ??? ????? ????? ??? ?? ?????? ?????? ? ??? ??????? ????? ??? ????? ??????????.
    2. ??? ??? ????? ??? ???? ????? ??? ???? ??????. ????? ????? ????? ??? ??? ??????? ?? ??????. ?????? RemoteTestRef.
    3. ????? ??????? ??????? ??? ?????? ????? ???? SingleCall ?? ????. ???? ??? ?????? SingleCall. ????? ??? ?????? ????? ?????? ??? ????? ??? ??????. ?? ???? ???? ???????? SingleCall ???? ???? ?? ????? ???? ????? ?? ??????? ????? ?? ???? ? ??? ??? ?????? ??? ?????? ??? ??????? ???? ?? ???. ??? ???? ? ??? ????? ????? ??? ????? ?????? ??? ????? ??? ???????? ???? ??????? ?? ??? ??????:
      RemotingConfiguration.RegisterWellKnownServiceType( _
       Type.GetType("ServerClassRef.HelloServer, ServerClassRef"), _
       "RemoteTestRef", _
       WellKnownObjectMode.SingleCall)
      						
  9. ???????? ????? ?????? ??? ??????? ???????? ??????? ReadLine ?????? ???? ??????:
    Console.WriteLine("Hit <enter> to exit...")
    Console.ReadLine()
    					
  10. ????? ???????.
  11. ???? ?? ??? ???????.

????? ???? ????? ???? ?????? ????? ????????

  1. ??? ????? Visual Studio 2005 ?? Visual Studio .NET.
  2. ????? ????? ???? ???? ???? ?? ??? ClientAppRef.
  3. ????? ????? ????? ???? ?? ?????? ???? ??????? Module1.vb ClientAppRef.vb.
  4. ????? ???? ??? ????? ????? System.Runtime.Remoting ??? ???????.
  5. ????? ???? ??? ???? ServerClassRef.dll ?? ?????? ?????? ?? ??? ???????.
  6. ?????? ????? ?????? ????????? ??? ?????? ????? ?? ???? ? Remoting.ChannelsRemoting.Channels.TCP ???? ?? ????? ??? ????? ????????? ?? ????? ??????? ?????? ?? ????????? ????????. ??? ??????? ???? ?????? ????????? ??? ?? ????????? ??????:
    Imports System.Runtime.Remoting
    Imports System.Runtime.Remoting.Channels
    Imports System.Runtime.Remoting.Channels.TCP
    					
  7. ????? ????? ????? ???? TcpChannel ???? ????????? ?????? ??????? ????? ??????. ??? ????? ?????? ??? ????? ???? TcpChannel ?????? ??????? ????? ???????. ??? ??? ??????? ???? ??? ????? ???? ??? ?????? ?????? ??? ????? ??? ????? ????????? ??? ??????. ???? ???? ?????? ???? ???????? ??? ??????. ??? ?? ???? ?????? ????? ???? ???? ???????? ?????? ????????. ????? ?????? ?? ????? ?????? ?????? ??????? ??????? RegisterChannel. ?????? ? ??? ????? ???? ForwardMe ???? ???? ???? ??????? ??? ???? ????. ????? ?????? ?????? ????? ?? ??????? ??????? ?? ?????? ??????? 1:
    Dim chan As TcpChannel = New TcpChannel(8086)
    ChannelServices.RegisterChannel(chan)
    Dim objForwardMe As New ServerClassRef.ForwardMe()
    					
  8. ???? ????? ??????? ?? ????? ???? ?????? ??????. ?? ??? ??????? ???? ????? ?????? HelloServer ???????? ??????? GetObject ?????? Activator. ??? ????? ??????? ???????:
    1. ??? ??? ?????? ?? ???? ??? ?????? ?? ??? ?????? ServerClassRef.HelloServer ???? ??? ??????? ServerClassRef. ??? ????? ?? ??? ????? ????? ??? classname ???. ???? ?? ??? ????? ????? ??? ?? ?????? ?????? ? ??? ??????? ????? ??? ????? ??????????.
    2. ???? ???? ????? (URI) ?????? ???? ????? ??? ?????. ??? ?? ????? URI ?????????? (tcp) ?? ??? ????????? (?????? ??????) ?? ?????? (8085) ? ????? ????? ???? ?????? (RemoteTestRef). ?????? URI "tcp: / / localhost:8085 / RemoteTestRef" ?????? ??? ???? ???? ServerClass.
      Dim objHelloServer As ServerClassRef.HelloServer
      
      objHelloServer = CType(Activator.GetObject( _
          Type.GetType("ServerClassRef.HelloServer, ServerClassRef"), _
          "tcp://localhost:8085/RemoteTestRef"), _
          ServerClassRef.HelloServer)
      If objHelloServer Is Nothing Then
          Console.WriteLine("Could not locate server")
      Else
          'See next step
      End If
      						
  9. ??? ?? ????? ???? ???? ?????? ?????, ???? ??????? ??????? ???? ?????? ????? ?? ???? ?? ?????? ?????? objForwardMe. ??? ????? ????? ?? ????? ????? ??? ???? ?? ??? ????:
    Dim objHelloServer As ServerClassRef.HelloServer
    
    objHelloServer = CType(Activator.GetObject( _
    	Type.GetType("ServerClassRef.HelloServer, ServerClassRef"), _
    	"tcp://localhost:8085/RemoteTestRef"), _
    	ServerClassRef.HelloServer)
    If objHelloServer Is Nothing Then
    	Console.WriteLine("Could not locate server")
    Else
    	objHelloServer.HelloMethod(objForwardMe)
    End If
    					
  10. ???????? ????? ?????? ??? ??????? ???????? ??????? ReadLine ?????? ???? ??????:
    Console.WriteLine("Hit <enter> to exit...")
    Console.ReadLine()
    					
  11. ????? ???????.
  12. ???? ?? ????? ?????? ??? ???????.
  13. ????? ??????? ??????? ????? ?????? ??? ??????. ??? ?? ????? ??????? ???????? ?? ???? ???? ?????? ?????? ???????. ??? ????? ??? ??????, ??? ??? ????? ????????? ??? ??????.

?????

???? ???? ??????? ?? ???? .NET (.NET Framework ?????? ??????)

??? TcpChannel (????? ?????? .NET Framework)

????? ???? ??? .NET - ??????? ?? ????
http://msdn.microsoft.com/en-us/library/kwdt6w2k(VS.80).aspx
??????? ?? ???? Microsoft .NET: ???? ??????
http://msdn2.microsoft.com/en-us/library/ms973857.aspx
????? Activator.GetObject (????? ?????? .NET Framework)

????? Type.GetType (????? ?????? .NET Framework)

????? RegisterWellKnownServiceType (????? ?????? .NET Framework)

???????

???? ???????: 301112 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 5.6
????? ???
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
????? ??????: 
kbnosurvey kbarchive kbmt kbvs2005applies kbvs2005swept kbhowtomaster KB301112 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????301112

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com