Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to quickly use configuration files to enable WCF metadata exchange

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to quickly use configuration files to enable WCF metadata exchange. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

WCF is still quite commonly used, so I studied the WCF metadata exchange, and I hope it will be useful to share it with you here. We all know that there are two ways for services to publish their own metadata. One is to provide metadata based on the HTTP-GET protocol, and the other is to use specialized endpoints as discussed later.

WCF can automatically provide HTTP-GET-based metadata for services, but service behaviors (Behavior) need to be explicitly added to support this functionality. Later chapters of this book will introduce the knowledge of behavior. For now, all we need to know is that the behavior belongs to the local characteristics of the service, such as whether metadata needs to be exchanged based on HTTP-GET, which is a service behavior. We can add behaviors programmatically or administratively. In the configuration file of the host application demonstrated, all managed services that reference the custom configuration section support metadata exchange based on the HTTP-GET protocol. In order to use HTTP-GET, the address used by the client needs to register the HTTP base address of the service. We can also specify an external URL in the behavior to achieve the same goal.

Enable WCF metadata exchange behavior using configuration files

......

Once HTTP-GET-based WCF metadata exchange is enabled, it can be accessed in the browser through the HTTP base address, if any. If everything is correct, you will get a confirmation page, as shown in the figure, informing the developer that the service has been successfully hosted. The confirmation page has nothing to do with IIS hosting, and even if we use self-hosting, we can use the browser to locate the service address.

Figure: confirmation page of the service

Thank you for reading! This is the end of the article on "how to quickly use the configuration file to enable WCF metadata exchange". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report