Skip to content

Instantly share code, notes, and snippets.

@yaronn
Created May 5, 2012 18:16
Show Gist options
  • Save yaronn/2604494 to your computer and use it in GitHub Desktop.
Save yaronn/2604494 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(Service)))
{
host.Description.Behaviors.Add(new ServiceMetadataBehavior() {
HttpGetEnabled = true,
HttpGetUrl = new System.Uri("http://localhost:7171/")});
var ep = host.AddServiceEndpoint("IService", new BasicHttpBinding(),
"http://localhost:7171/");
ep.Behaviors.Add(new MyWsdlExporter());
host.Open();
Console.WriteLine("\nPress enter to close service...\n");
Console.ReadLine();
}
}
class MyWsdlExporter : IWsdlExportExtension, IEndpointBehavior
{
public void ExportEndpoint(WsdlExporter exporter,
WsdlEndpointConversionContext context)
{
context.WsdlPort.Documentation = "crearted on " + DateTime.Now.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment