WCF netTcp配置
- 服务端配置
- <system.serviceModel>
- <bindings>
- <netTcpBinding>
- <binding name="netTcpExpenseService_ForSupplier" closeTimeout="00:01:00"
- openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
- transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
- hostNameComparisonMode="StrongWildcard" listenBacklog="10"
- maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
- maxReceivedMessageSize="2147483647">
- <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
- maxBytesPerRead="4096" maxNameTableCharCount="16384" />
- <reliableSession ordered="true" inactivityTimeout="00:10:00"
- enabled="false" />
- <security mode="None">
- <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
- <message clientCredentialType="Windows" />
- </security>
- </binding>
- </netTcpBinding>
- </bindings>
- <services>
- <!--联系人服务-->
- <service name="Service.Implement.Travel.Supplyer.Contact_Service">
- <endpoint address="net.tcp://10.1.3.203:9999/Service.Implement.Travel.Supplyer.Contact_Service"
- contract="Service.Interface.Travel.Supplyer.Contact_IService"
- binding="netTcpBinding" bindingConfiguration="netTcpExpenseService_ForSupplier"/>
- </service>
- </services>
- <behaviors>
- <serviceBehaviors>
- <behavior name="MyServiceTypeBehaviors" >
- <serviceMetadata httpGetEnabled="true" />
- </behavior>
- </serviceBehaviors>
- </behaviors>
- </system.serviceModel>
- 1,<security mode="Transport"> 安全性修改 <security mode="None">
- 2,绑定监听配置 bindingConfiguration="netTcpExpenseService_ForSupplier"
- 3,服务端设置<services>节点
- 客户端配置
- <system.serviceModel>
- <bindings>
- <netTcpBinding>
- <binding name="netTcpExpenseService_ForSupplier" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
- transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10"
- maxBufferPoolSize="20000000" maxBufferSize="20000000" maxConnections="10" maxReceivedMessageSize="2147483647">
- <readerQuotas maxDepth="32" maxStringContentLength="8192000" maxArrayLength="8192000" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
- <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
- <security mode="None">
- <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
- <message clientCredentialType="Windows"/>
- </security>
- </binding>
- </netTcpBinding>
- </bindings>
- <client>
- <endpoint name="ContactService" address="net.tcp://10.1.3.203:9999/Service.Implement.Travel.Supplyer.Contact_Service"
- contract="Service.Interface.Travel.Supplyer.Contact_IService" binding="netTcpBinding" bindingConfiguration="netTcpExpenseService_ForSupplier"/>
- </client>
- </system.serviceModel>
- 1,<security mode="Transport"> 安全性修改 <security mode="None">
- 2,绑定监听配置 bindingConfiguration="netTcpExpenseService_ForSupplier"
- 3,客户端设置 <client>节点
- 总结:监听协议,服务端和客户端netTcpBinding节点配置保持一致.
- 调用wcf接口
- Contact_IService iwt = WCFClientProxy<Contact_IService>.GetReusableFaultUnwrappingInstance("ContactService");
- Contact model = new Contact();
- model.SupplierID = 4706;
- model.ContactType = 1;
- List<Contact> list = iwt.GetContactList(model);
- var query = list.Take(1).ToList();//默认取第一个
- string tel = string.Empty;
- string fax = string.Empty;
- foreach (var item in query)
- {
- tel = item.ContactPhone;
- fax = item.ContactFax;
- }
- Response.Write("电话:" + tel + "\n" + "传真:" + fax);
WCF netTcp配置的更多相关文章
- WCF服务配置编辑器使用
学习wcf,特别是初学者,配置文件很难搞懂,有点复杂,自己手动配置哪有这么多精力啊,这不是吃的太饱了吗,所以学会使用配置编辑器是必须的,下面是学习的流程图. 打开工具的wcf服务配置编辑器,点击文件= ...
- WCF初探-6:WCF服务配置
WCF服务配置是WCF服务编程的主要部分.WCF作为分布式开发的基础框架,在定义服务以及定义消费服务的客户端时,都使用了配置文件的方法.虽然WCF也提供硬编程的方式,通过在代码中直接设置相关对象的属性 ...
- WCF初探-7:WCF服务配置工具使用
在上一篇WCF服务配置中,文章讲解了WCF的配置所需要的基本节点和属性构造,但是对于初学者的我们在编写程序的时候,往往对这些节点的位置和属性不是特别清楚,所以就导致我们的因配置文件错误而不能运行服务程 ...
- WCF系列教程之WCF服务配置工具
本文参考自http://www.cnblogs.com/wangweimutou/p/4367905.html Visual studio 针对服务配置提供了一个可视化的配置界面(Microsoft ...
- 2 WCF里面配置的含义
1 首先介绍所谓的a,b,c. a就是address 地址: b binding 绑定的协议 譬如http tcp udp 利用这些协议方式请求address: c contract 代表请求的规 ...
- WCF学习之旅—WCF服务配置(十四)
一.概述 我们在前面章节中讲了寄宿,在前面的实例中也用到了配置文件,这一篇主要讲讲如何在应用配置文件,提高WCF程序的灵活性.在编写WCF服务应用程序时,编写配置项也是其中一项主要工作,在前面的几个示 ...
- Wcf:可配置的服务调用方式
添加wcf服务引用时,vs.net本来就会帮我们在app.config/web.config里生成各种配置,这没啥好研究的,但本文谈到的配置并不是这个.先看下面的图: 通常,如果采用.NET的WCF技 ...
- WCF HTTPS配置
昨天需要把做好的一个wcf服务发布到服务器站点下的一个虚拟目录中发布过程遇到了一个问题:服务器上的环境是https,因此需要多对配置文件修改于是在网上找啊找,遇到一个问题找一个问题,可是问题依然没解决 ...
- WCF系列教程之WCF服务配置
文本参考自:http://www.cnblogs.com/wangweimutou/p/4365260.html 简介:WCF作为分布式开发的基础框架,在定义服务以及消费服务的客户端时可以通过配置文件 ...
随机推荐
- 循环报数 Java实现
输入1个数字和多个字符,中间均以空格隔开.假设数字取值为m(范围1~9),后面字符个数为n.假设n个字符围成一圈,从第一个字母开始循环报数,当数到m以后,第m个字母就出列,直到这n个字母全部出列.最后 ...
- OC语言基础知识
OC语言基础知识 一.面向对象 OC语言是面向对象的,c语言是面向过程的,面向对象和面向过程只是解决问题的两种思考方式,面向过程关注的是解决问题涉及的步骤,面向对象关注的是设计能够实现解决问题所需功能 ...
- iOS开发UI篇—Quartz2D使用(绘图路径)
iOS开发UI篇—Quartz2D使用(绘图路径) 一.绘图路径 A.简单说明 在画线的时候,方法的内部默认创建一个path.它把路径都放到了path里面去. 1.创建路径 cgmutablepat ...
- enmo_day_03
安装 装载点 : /u01 (第一个挂载点 LUN1) /u01 (第二个挂载点LUN2) /disk01 目录 : /u01/app/oracle /u01/app/app 文件 : 控制文件 :c ...
- C++ STL算法系列2---find ,find_first_of , find_if , adjacent_find的使用
一.find运算 假设有一个int型的vector对象,名为vec,我们想知道其中是否包含某个特定值. 解决这个问题最简单的方法时使用标准库提供的find运算: 1 // value we'll lo ...
- 5、android ConnectivityManager获取网络状态
? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 ...
- Joomla 文件操作常用方法
今天介绍下joomla下文件操作常用方法,这些方法在文件读写,图片文件上传,等都有用处. jimport('joomla.filesystem.file'); $j = new JFile(); ge ...
- Nodejs连接mysql
1.首先需要安装nodejs 的mysql包 npm install mysql 2.编写nodejs与mysql交互的代码 var mysql = require('mysql'); var TES ...
- MySQL日期 字符串 时间戳互转
平时比较常用的时间.字符串.时间戳之间的互相转换,虽然常用但是几乎每次使用时候都喜欢去搜索一下用法:本文将作为一个笔记,整理一下三者之间的 转换(即:date转字符串.date转时间戳.字符串转dat ...
- Python 入门指南
Release: 3.4 Date: March 29, 2014 Python 是一门简单易学且功能强大的编程语言. 它拥有高效的高级数据结构,并且能够用简单而又高效的方式进行面向对象编程. Pyt ...