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作为分布式开发的基础框架,在定义服务以及消费服务的客户端时可以通过配置文件 ...
随机推荐
- ORACLE日期格式
to_date("要转换的字符串","转换的格式") 两个参数的格式必须匹配,否则会报错. 即按照第二个参数的格式解释第一个参数. to_char(日期,& ...
- iOS开发UI篇—Quartz2D使用(截屏)
iOS开发UI篇—Quartz2D使用(截屏) 一.简单说明 在程序开发中,有时候需要截取屏幕上的某一块内容,比如捕鱼达人游戏.如图: 完成截屏功能的核心代码:- (void)renderInCont ...
- HTTP 错误 500.23 - Internal Server Error 解决方法
分析原因:在安装完成后IIS已经支持ASP和ASP.NET 2.0,需要注意的是.NET站点的应用程序池应选用Classic .NET AppPool,而不能用默认的DefaultAppPool,否则 ...
- ES6 基础版迭代器
ES6中引入了generator function* get() { var result1 = yield c; var result2 = yield b; var result3 = yield ...
- CodeForces 686A-Free Ice Cream
题目: 儿童排队领冰激凌,给你两个数n,x分别代表接下来有n行与初始的冰激淋数:接下来n行,每行有一个字符('+'or‘-’),还有一个整数d,+d表示新增的冰激 凌数(由搬运工搬运到此),-d表示儿 ...
- Android之View和SurfaceView
Android之View和SurfaceView Android游戏当中主要的除了控制类外就是显示类View.SurfaceView是从View基类中派生出来的显示类.android游戏开发中常用的三 ...
- 编程技术●Python
<Python语言入门> 2015-01-16 14:13 ★ 虽然书名叫入门.序里也写了说完全没有编程经验的都可以用这本书来学习入门.不过好像不太适合哦.书很好,内容也挺全面细致的.太好 ...
- phalcon:跟踪sql语句
在phalcon里有一个\Phalcon\Db\Profiler 类,这个类可以用来记录sql语句并计算消耗的时间.那么如何使用它呢? 手册里其实已经提供了方法,总结如下: 1.向$di里注册prof ...
- Using python to process Big Data
Pandas is a great lib to process BIg Data. 1) pandas.pivot_table(data,values=None,columns=None,aggfu ...
- [GodLove]Wine93 Tarining Round #3
比赛链接: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=44857#overview 题目来源: ZOJ Monthly, July 2 ...