您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 第7章 .NET Remoting
.NET.NET77.NET.NETRemotingRemotingtyx@hit.edu.cntyx@hit.edu.cn77.NET.NETRemotingRemoting2/27.NET.NETRemotingRemoting&&nn.NET.NETRemotingRemotingnnnnnnChannelsChannelsnnnn.NET.NETRemotingRemotingnn.NET.NETRemotingRemotingnn77.NET.NETRemotingRemoting3/27.NET.NETRemotingRemotingnn.NET.NETRemotingRemoting??nn.NET.NETRemotingRemotingCLRCLRnnnnXMLWebServicesXMLWebServicesnnHTTPHTTPSOAPSOAPXMLXMLnnDCOMDCOMnnnn.NET.NETRemotingRemotingnn77.NET.NETRemotingRemoting4/27.NET.NETRemotingRemotingnn.NET.NETRemotingRemotingnnWebServicesAnywhereWebServicesAnywherennWebServicesWebServicesWebWebIISIISnn.NET.NETRemotingRemotingnnnnWindowsWindowsnnWindowsWindowsnnIISIISnn.NET.NETRemotingRemotingnnTCPTCPHTTPHTTPnnCLRCLRDCOMDCOM77.NET.NETRemotingRemoting5/27.NET.NETRemotingRemotingnn.NET.NETRemotingRemotingClientObjectServerObjectClientServiceProxyFormatterChannelFormatterChannel77.NET.NETRemotingRemoting6/27nnMarshalbyReferenceMarshalbyReferenceMBRMBRnnSystem.MarshalByRefObjectSystem.MarshalByRefObjectnnMBRMBRnnMarshalbyValueMarshalbyValueMBVMBVnnSystem.MarshalByRefObjectSystem.MarshalByRefObjectISerializableISerializable77.NET.NETRemotingRemoting7/27nnnnnnSingletonSingletonnnSingleCallSingleCallRemotingConfiguration.RemotingConfiguration.RegisterWellKnownServiceTypeRegisterWellKnownServiceType((typeof(RemotableClasstypeof(RemotableClass),),////RemoteObjectRemoteObject,,////URIURIWellKnownObjectMode.SingleCallWellKnownObjectMode.SingleCall////););77.NET.NETRemotingRemoting8/27nnnnRemotingConfiguration.RemotingConfiguration.RegisterActivatedServiceTypeRegisterActivatedServiceType((typeof(RemotableClasstypeof(RemotableClass))////););77.NET.NETRemotingRemoting9/27ChannelsChannelsnnChannelsChannelsnnnnnnnnnnHTTPHTTPnnHTTPHTTPSOAPSOAPSOAPSOAPXMLXMLnnTCPTCPnnTCPTCPTCPTCPURIURI77.NET.NETRemotingRemoting10/27ChannelsChannelsnnnnnnTcpServerChannelTcpServerChannelchannel=newTcpServerChannel(1234);channel=newTcpServerChannel(1234);ChannelServices.RegisterChannel(channelChannelServices.RegisterChannel(channel););TcpClientChannelTcpClientChannelchannel=newchannel=newTcpClientChannelTcpClientChannel();();ChannelServices.RegisterChannel(channelChannelServices.RegisterChannel(channel););77.NET.NETRemotingRemoting11/27nnnnnnRemotingConfiguration.RemotingConfiguration.RegisterWellKnownClientTypeRegisterWellKnownClientType((typeof(RemotableClasstypeof(RemotableClass),),////tcp://localhost:1234/RemoteObjecttcp://localhost:1234/RemoteObject////URIURI););RemotableClassRemotableClassobjobj=new=newRemotableClassRemotableClass();();RemotableClassRemotableClassobjobj=(=(RemotableClass)Activator.GetObjectRemotableClass)Activator.GetObject((typeof(RemotableClasstypeof(RemotableClass),),////tcp://localhost:1234/RemoteObjecttcp://localhost:1234/RemoteObject////URIURI););77.NET.NETRemotingRemoting12/27nnnnnnRemotingConfiguration.RemotingConfiguration.RegisterActivatedClientTypeRegisterActivatedClientType((typeof(RemotableClasstypeof(RemotableClass),),////tcp://localhost:1234/RemoteObjecttcp://localhost:1234/RemoteObject////URIURI););RemotableClassRemotableClassobjobj=new=newRemotableClassRemotableClass();();object[]object[]urlurl={newUrlAttribute(tcp://localhost:1234)};={newUrlAttribute(tcp://localhost:1234)};RemotableClassRemotableClassobjobj=(=(RemotableClass)Activator.CreateInstanceRemotableClass)Activator.CreateInstance((typeof(RemotableClasstypeof(RemotableClass),null,),null,urlurl););77.NET.NETRemotingRemoting13/27.NET.NETRemotingRemotingnnnnMBVMBVMBRMBRnnnnnnnnnnnnnnnn77.NET.NETRemotingRemoting14/27.NET.NETRemotingRemotingnn////ClockServer.csClockServer.csusingSystem;usingSystem;publicclassClock:publicclassClock:MarshalByRefObjectMarshalByRefObject{{publicstringpublicstringGetCurrentTimeGetCurrentTime()(){{returnreturnDateTime.Now.ToLongTimeStringDateTime.Now.ToLongTimeString();();}}}}csccsc//t:libraryt:libraryClockServer.csClockServer.cs77.NET.NETRemotingRemoting15/27.NET.NETRemotingRemotingnn////TimeServer.csTimeServer.csusingSystem;usingSystem;usingusingSystem.Runtime.RemotingSystem.Runtime.Remoting;;usingusingSystem.Runtime.Remoting.ChannelsSystem.Runtime.Remoting.Channels;;usingusingSystem.Runtime.Remoting.Channels.TcpSystem.Runtime.Remoting.Channels.Tcp;;classclassMyAppMyApp{{staticvoidMain(){staticvoidMain(){TcpServerChannelTcpServerChannelchannel=newchannel=newTcpServerChannelTcpServerChannel(1234);(1234);ChannelServices.RegisterChannelChannelServices.RegisterChannel(channel);(channel);RemotingConfiguration.RegisterWellKnownServiceTypeRemotingConfiguration.RegisterWellKnownServiceType((typeoftypeof(Clock),Clock,(Clock),Clock,WellKnownObjectMode.SingleCallWellKnownObjectMode.SingleCall););Console.WriteLineConsole.WriteLine(PressEntertoterminate...);(PressEntertoterminate...);Console.ReadLineConsole.ReadLine();();}}}}csccsc//r:ClockServer.dllr:ClockServer.dllTimeServer.csTimeServer.cs77.NET.NETRemotingRemoting16/27.NET.NETRemotingRemotingnn////TimeClient.csTimeClient.csusingSystem;usingSystem;usingusingSystem.Runtime.RemotingSystem.Runtime.Remotin
本文标题:第7章 .NET Remoting
链接地址:https://www.777doc.com/doc-5476665 .html