本文整理汇总了C#中System.Runtime.Remoting.RemotingConfiguration.RegisterActivatedServiceType方法的典型用法代码示例。如果您正苦于以下问题:C# RemotingConfiguration.RegisterActivatedServiceType方法的具体用法?C# RemotingConfiguration.RegisterActivatedServiceType怎么用?C# RemotingConfiguration.RegisterActivatedServiceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了RemotingConfiguration.RegisterActivatedServiceType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
public class ServerClass {
public static void Main() {
ChannelServices.RegisterChannel(new TcpChannel(8082));
RemotingConfiguration.RegisterActivatedServiceType(typeof(HelloServiceClass));
Console.WriteLine("Press enter to stop this process.");
Console.ReadLine();
}
}
开发者ID:.NET开发者,项目名称:System.Runtime.Remoting,代码行数:18,代码来源:RemotingConfiguration.RegisterActivatedServiceType
示例2: HelloServiceClass
//引入命名空间
using System;
public class HelloServiceClass : MarshalByRefObject {
static int n_instance;
public HelloServiceClass() {
n_instance++;
Console.WriteLine(this.GetType().Name + " has been created. Instance # = {0}", n_instance);
}
~HelloServiceClass() {
Console.WriteLine("Destroyed instance {0} of HelloServiceClass.", n_instance);
n_instance --;
}
public String HelloMethod(String name) {
// Reports that the method was called.
Console.WriteLine();
Console.WriteLine("Called HelloMethod on instance {0} with the '{1}' parameter.",
n_instance, name);
// Calculates and returns the result to the client.
return "Hi there " + name + ".";
}
}
开发者ID:.NET开发者,项目名称:System.Runtime.Remoting,代码行数:28,代码来源:RemotingConfiguration.RegisterActivatedServiceType