The WCF Service can publish their metadata in two ways.
The HTTP-GET is transferred or published directly through the endpoint. If metadata is published through a HTTP-GET, all you have to do is
The service node adds the behaviorconfiguration property and activates the HTTP-GET. (For a complete configuration file sample, refer
Http://www.cnblogs.com/anders-x-hu/archive/2007/05/30/765449.html)
Programming Control metadata
Using System;
Using System. servicemodel;
Using System. servicemodel. channels;
Using System. servicemodel. description;
Namespace Anrs. Service
{
Class Program
{
Static Void Main ( String [] ARGs)
{
Servicehost sh = New Servicehost ( Typeof (Anrsservice ));
Servicemetadatabehavior metadata = Sh. description. behaviors. Find < Servicemetadatabehavior > ();
Binding wshttpbinding = New Wshttpbinding ();
If (Metadata = Null )
{
Metadata = New Servicemetadatabehavior ();
Metadata. httpgetenabled = True ;
Sh. description. behaviors. Add (metadata );
}
Sh. addserviceendpoint (Typeof(Ianrsservicecontract1), wshttpbinding,NewUri ("HTTP: /localhost: 8086/anrsservice/"));
Sh. open ();
Console. Write ("Press any key to exit");
Console. Readline ();
Sh. Close ();
}
}
}
Again, it proves that WCF is not a programming innovation, but more a conceptual innovation.