Here is the code based version of the
Simple service. Like the
client, this one uses no config at all;
using System;
using System.ServiceModel;
namespace Gudge.Samples.SimpleCode {
[ServiceContract]
interfaceISimple {
[OperationContract]
string Ping(string text);
}
classService : ISimple {
staticvoid Main(string[] args) {
BasicProfileBinding b = newBasicProfileBinding();
Uri u = newUri ( "http://localhost:8080/simple" );
ServiceHost<Service> sh = newServiceHost<Service>();
sh.AddEndpoint( typeof(ISimple), b, u);
sh.Open();
Console.WriteLine("Press enter to close the service");
Console.ReadLine();
}
publicstring Ping(string text) {
return text;
}
}
}
Posted
May 11 2005, 07:00 PM
by
martin-gudgin