[Programming WCF Services]Chapter 1. WCF Essentials - Metadata Exchange
1.HTTP-GET WCF 方式
通过Http的方式提供metadata
1.1.配置文件方式
<system.serviceModel>
<services>
<service name = "MyService" behaviorConfiguration = "MEXGET">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/"/>
</baseAddresses>
</host>
...
</service> <service name = "MyOtherService" behaviorConfiguration = "MEXGET">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8001/"/>
</baseAddresses>
</host>
...
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name = "MEXGET">
<serviceMetadata httpGetEnabled = "true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
一般通过HTTP的基地址即可以访问元数据,也可以指定不同的地址:
<behavior name = "MEXGET">
<serviceMetadata httpGetEnabled = "true" httpGetUrl = "MyMEXAddress"/>
</behavior>
1.2.代码方式
ServiceHost host = new ServiceHost(typeof(MyService));
ServiceMetadataBehavior metadataBehavior;
metadataBehavior = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
if(metadataBehavior == null)
{
Debug.Assert(BaseAddresses.Any(baseAddress=>baseAddress.Uri.Scheme == "http"));
metadataBehavior = new ServiceMetadataBehavior();
metadataBehavior.HttpGetEnabled = true;
host.Description.Behaviors.Add(metadataBehavior);
}
host.Open();
2.Metadata Exchange Endpoint
平台无关的元数据交换方式,支持多种协议
<services>
<service name = "MyService" behaviorConfiguration = "MEX">
<host>
<baseAddresses>
<add baseAddress = "net.tcp://localhost:8001/"/>
<add baseAddress = "net.pipe://localhost/"/>
</baseAddresses>
</host>
<endpoint
address = "MEX"
binding = "mexTcpBinding"
contract = "IMetadataExchange"
/>
<endpoint
address = "MEX"
binding = "mexNamedPipeBinding"
contract = "IMetadataExchange"
/>
<endpoint
address = "http://localhost:8000/MEX"
binding = "mexHttpBinding"
contract = "IMetadataExchange"
/>
...
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name = "MEX">
<serviceMetadata/>
</behavior>
</serviceBehaviors>
</behaviors>
[Programming WCF Services]Chapter 1. WCF Essentials - Metadata Exchange的更多相关文章
- [Programming WCF Services]Chapter 1. WCF Essentials - EndPoint
1.配置文件方式设置EndPoint(ABC) 1.1.基本配置 <system.serviceModel> <services> <service name=" ...
- WCF4.0 –- RESTful WCF Services (1) (入门)
WCF 很好的支持了 REST 的开发, 而 RESTful 的服务通常是架构层面上的考虑. 因为它天生就具有很好的跨平台跨语言的集成能力,几乎所有的语言和网络平台都支持 HTTP 请求,无需去实现复 ...
- How To Easily Call WCF Services Properly z
Please note: this article has been superceded by the documentation for the ChannelAdam WCF Library. ...
- Learing WCF Chapter1 WCF Services
WCF ServicesWCF services are the new distributed boundary in an enterprise application—with an empha ...
- WCF4.0 –- RESTful WCF Services
转自:http://blog.csdn.net/fangxinggood/article/details/6235662 WCF 很好的支持了 REST 的开发, 而 RESTful 的服务通常是架构 ...
- IIS8.0 部署WCF Services
今天在Win 8的IIS上部署WCF Services,访问SVC文件时出现找不到处理程序的错误,以前遇到这个问题时都是尝试通过注册asp.net的方式处理一下,但是在Win8下这招不灵了,出现如下提 ...
- WCF学习之旅—WCF寄宿前的准备(八)
一.WCF服务应用程序与WCF服务库 我们在平时开发的过程中常用的项目类型有“WCF 服务应用程序”和“WCF服务库”. WCF服务应用程序,是一个可以执行的程序,它有独立的进程,WCF服务类协定的定 ...
- WCF学习之旅—WCF服务部署到应用程序(十)
上接 WCF学习之旅—WCF寄宿前的准备(八) WCF学习之旅—WCF服务部署到IIS7.5(九) 五.控制台应用程序宿主 (1) 在解决方案下新建控制台输出项目 ConsoleHosting.如下 ...
- WCF学习之旅—WCF服务的Windows 服务程序寄宿(十一)
上接 WCF学习之旅—WCF服务部署到IIS7.5(九) WCF学习之旅—WCF服务部署到应用程序(十) 七 WCF服务的Windows 服务程序寄宿 这种方式的服务寄宿,和IIS一样有一个一样 ...
随机推荐
- git 提交到github时不用每次都输入用户名,密码
Permanently authenticating with Git repositories, Run following command to enable credential caching ...
- 格式化格林威治时间(Wed Aug 01 00:00:00 CST 2012)
1.如果格林威治时间时间是date类型.(这种格式最简单) SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd") ...
- Timewarp 一种生成当中帧技术,异步时间扭曲(Asynchronous Timewarp)
翻译: https://www.oculus.com/blog/asynchronous-timewarp/ 异步时间扭曲(Asynchronous Timewarp 时间扭曲,即调整时长) 关 ...
- ubuntu14下python环境的配置
1.安装build依赖包(一些包需要用pip编译) sudo apt-get install python-dev 2.安装pip包管理工具 sudo apt-get install python-p ...
- VS2013使用技巧汇总
1. Peek View 在不新建TAB的情况下快速查看.编辑一个函数的代码. 以前要看一个函数的实现,需要在使用的地方点击F12跳转到该函数,实际上这是很浪费时间的.VS2013Peek View便 ...
- oracle_一次移动数据库dbf文件的操作
oracle数据库的dbf路径下面磁盘不足,需要把原始路径下面的dbf文件移动到另外一个磁盘路径下, 具体的操作有四步. 1.把整个表空间offline. 2.copy原始路径下的dbf文件到新的路径 ...
- .bat批处理命令的介绍
HUC = = D组 http://www.cnhonkerarmy.com/ 63707869 =====================================开始============ ...
- java中iofile的路径问题,确定一个未知方法所需要的文件路径
今天遇到一个极其烦躁的问题,一个jar包中的一个方法,要求函数中要求传入一个String类型的参数,用于指示文件所在的路径.但是对于我们来说完全不知道他需要的路径是绝对路径还是相对路径,所以我尝试了很 ...
- Centos6.5安装与配置Tomcat-8的方法
环境要求: 系统: [root@Wulaoer ~]# cat /proc/version Linux version 2.6.32-431.el6.x86_64 (mockbuild@c6b8.bs ...
- HDU 5875 st+二分区间
题目大意:给你n个数,q次询问,每次询问区间[l, r],问a[i]%a[i + 1] % a[i + 2]...%a[j](j <= r)的值 思路:st预处理维护,再二分区间,复杂度n*(l ...