mark ApplicationAccessControl
using System;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;
[assembly: ApplicationName("Demo")]
[assembly: Description("C#")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationAccessControl(false)]
public interface IGreeting {
string Welcome(string name);
}
[EventTrackingEnabled(true)]
[Description("Simple Serviced Component Sample")]
public class SimpleComponent : ServicedComponent, IGreeting {
public SimpleComponent() {
}
public string Welcome(string name) {
// simulate some processing time
System.Threading.Thread.Sleep(1000);
return "Hello, " + name;
}
}
class Program {
static void Main(string[] args) {
using (SimpleComponent obj = new SimpleComponent()) {
for (int i = 0; i < 10; i++) {
Console.WriteLine(obj.Welcome("Kathie"));
}
}
}
}
Related examples in the same category