当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET RemotingConfiguration.RegisterWellKnownServiceType方法代码示例

本文整理汇总了VB.NET中System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType方法的典型用法代码示例。如果您正苦于以下问题:VB.NET RemotingConfiguration.RegisterWellKnownServiceType方法的具体用法?VB.NET RemotingConfiguration.RegisterWellKnownServiceType怎么用?VB.NET RemotingConfiguration.RegisterWellKnownServiceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。


在下文中一共展示了RemotingConfiguration.RegisterWellKnownServiceType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: ObjRefExample

' 导入命名空间
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Http
Imports System.Runtime.Remoting.Messaging
Imports System.Runtime.Serialization
Imports System.Security.Permissions

' code that drives the example
Public Class ObjRefExample

   <PermissionSet(SecurityAction.LinkDemand)> _
   Public Overloads Shared Sub Main()
      ChannelServices.RegisterChannel(New HttpChannel(8090))

      RemotingConfiguration.RegisterWellKnownServiceType(New WellKnownServiceTypeEntry(GetType(RemoteObject), "RemoteObject", WellKnownObjectMode.Singleton))

      Dim RObj As RemoteObject = CType(Activator.GetObject(GetType(RemoteObject), "http://localhost:8090/RemoteObject"), RemoteObject)
      Dim LObj As New LocalObject()

      RObj.Method1(LObj)

      Console.WriteLine("Press Return to exit...")

      Console.ReadLine()
   End Sub

End Class


' a simple remote object
<PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
Public Class RemoteObject
   Inherits MarshalByRefObject

   Public Sub Method1(ByVal param As LocalObject)
       Console.WriteLine("Invoked: Method1({0})", param)
   End Sub

End Class
开发者ID:VB.NET开发者,项目名称:System.Runtime.Remoting,代码行数:40,代码来源:RemotingConfiguration.RegisterWellKnownServiceType

示例2: Main

' 导入命名空间
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp


Public Class ServerClass
   
   Public Shared Sub Main()
开发者ID:VB.NET开发者,项目名称:System.Runtime.Remoting,代码行数:9,代码来源:RemotingConfiguration.RegisterWellKnownServiceType

示例3: TcpChannel

ChannelServices.RegisterChannel(New TcpChannel(8082))

RemotingConfiguration.ApplicationName = "HelloServiceApplication"

RemotingConfiguration.RegisterWellKnownServiceType(GetType(HelloService), "MyUri", WellKnownObjectMode.SingleCall)
开发者ID:VB.NET开发者,项目名称:System.Runtime.Remoting,代码行数:5,代码来源:RemotingConfiguration.RegisterWellKnownServiceType

示例4:

Console.WriteLine("Press enter to stop this process.")
      Console.ReadLine()

   End Sub

End Class
开发者ID:VB.NET开发者,项目名称:System.Runtime.Remoting,代码行数:6,代码来源:RemotingConfiguration.RegisterWellKnownServiceType

示例5: New

Public Class HelloService
   Inherits MarshalByRefObject
   
   Private Shared n_instances As Integer
     
   Public Sub New()
      n_instances += 1
      Console.WriteLine("")
      Console.WriteLine("HelloService activated - instance # {0}.", n_instances)
   End Sub
   
   
   Protected Overrides Sub Finalize()
      Console.WriteLine("HelloService instance {0} destroyed.", n_instances)
      n_instances -= 1
      MyBase.Finalize()
   End Sub
   
   
   Public Function HelloMethod(name As [String]) As [String]
      Console.WriteLine("HelloMethod called on HelloService instance {0}.", n_instances)
      Return "Hi there " + name + "."
   End Function 'HelloMethod

End Class
开发者ID:VB.NET开发者,项目名称:System.Runtime.Remoting,代码行数:25,代码来源:RemotingConfiguration.RegisterWellKnownServiceType


注:本文中的System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。