using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
[ServiceContract]
public interface IHelloWCF
{
[OperationContract]
string SayHello();
}
public class HelloWCFService : IHelloWCF
{
string WCFHelloWorldService.IHelloWCF.SayHello()
{
return ("Hello WCF!");
}
}
class Program
{
static void Main(string[] args)
{
ServiceHost host = new ServiceHost(typeof(WCFHelloWorldService.HelloWCFService));
host.Open();
Console.WriteLine("running.");
Console.WriteLine("Press <enter> to close host.");
Console.ReadLine();
host.Close();
}
}
|