[WCF] Metadata Exchange

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.