1. 服务端配置
  2. <system.serviceModel>
  3. <bindings>
  4. <netTcpBinding>
  5. <binding name="netTcpExpenseService_ForSupplier" closeTimeout="00:01:00"
  6. openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
  7. transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
  8. hostNameComparisonMode="StrongWildcard" listenBacklog="10"
  9. maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
  10. maxReceivedMessageSize="2147483647">
  11. <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
  12. maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  13. <reliableSession ordered="true" inactivityTimeout="00:10:00"
  14. enabled="false" />
  15. <security mode="None">
  16. <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
  17. <message clientCredentialType="Windows" />
  18. </security>
  19. </binding>
  20. </netTcpBinding>
  21. </bindings>
  22. <services>
  23. <!--联系人服务-->
  24. <service name="Service.Implement.Travel.Supplyer.Contact_Service">
  25. <endpoint address="net.tcp://10.1.3.203:9999/Service.Implement.Travel.Supplyer.Contact_Service"
  26. contract="Service.Interface.Travel.Supplyer.Contact_IService"
  27. binding="netTcpBinding" bindingConfiguration="netTcpExpenseService_ForSupplier"/>
  28. </service>
  29. </services>
  30. <behaviors>
  31. <serviceBehaviors>
  32. <behavior name="MyServiceTypeBehaviors" >
  33. <serviceMetadata httpGetEnabled="true" />
  34. </behavior>
  35. </serviceBehaviors>
  36. </behaviors>
  37. </system.serviceModel>
  38. 1,<security mode="Transport">  安全性修改   <security mode="None">
  39. 2,绑定监听配置 bindingConfiguration="netTcpExpenseService_ForSupplier"
  40. 3,服务端设置<services>节点
  41. 客户端配置
  42. <system.serviceModel>
  43. <bindings>
  44. <netTcpBinding>
  45. <binding name="netTcpExpenseService_ForSupplier" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
  46. transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10"
  47. maxBufferPoolSize="20000000" maxBufferSize="20000000" maxConnections="10" maxReceivedMessageSize="2147483647">
  48. <readerQuotas maxDepth="32" maxStringContentLength="8192000" maxArrayLength="8192000" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
  49. <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
  50. <security mode="None">
  51. <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
  52. <message clientCredentialType="Windows"/>
  53. </security>
  54. </binding>
  55. </netTcpBinding>
  56. </bindings>
  57. <client>
  58. <endpoint name="ContactService" address="net.tcp://10.1.3.203:9999/Service.Implement.Travel.Supplyer.Contact_Service"
  59. contract="Service.Interface.Travel.Supplyer.Contact_IService" binding="netTcpBinding" bindingConfiguration="netTcpExpenseService_ForSupplier"/>
  60. </client>
  61. </system.serviceModel>
  62. 1,<security mode="Transport">  安全性修改   <security mode="None">
  63. 2,绑定监听配置 bindingConfiguration="netTcpExpenseService_ForSupplier"
  64. 3,客户端设置 <client>节点
  65. 总结:监听协议,服务端和客户端netTcpBinding节点配置保持一致.
  66. 调用wcf接口
  67. Contact_IService iwt = WCFClientProxy<Contact_IService>.GetReusableFaultUnwrappingInstance("ContactService");
  68. Contact model = new Contact();
  69. model.SupplierID = 4706;
  70. model.ContactType = 1;
  71. List<Contact> list = iwt.GetContactList(model);
  72. var query = list.Take(1).ToList();//默认取第一个
  73. string tel = string.Empty;
  74. string fax = string.Empty;
  75. foreach (var item in query)
  76. {
  77. tel = item.ContactPhone;
  78. fax = item.ContactFax;
  79. }
  80. Response.Write("电话:" + tel + "\n" + "传真:" + fax);

WCF netTcp配置的更多相关文章

  1. WCF服务配置编辑器使用

    学习wcf,特别是初学者,配置文件很难搞懂,有点复杂,自己手动配置哪有这么多精力啊,这不是吃的太饱了吗,所以学会使用配置编辑器是必须的,下面是学习的流程图. 打开工具的wcf服务配置编辑器,点击文件= ...

  2. WCF初探-6:WCF服务配置

    WCF服务配置是WCF服务编程的主要部分.WCF作为分布式开发的基础框架,在定义服务以及定义消费服务的客户端时,都使用了配置文件的方法.虽然WCF也提供硬编程的方式,通过在代码中直接设置相关对象的属性 ...

  3. WCF初探-7:WCF服务配置工具使用

    在上一篇WCF服务配置中,文章讲解了WCF的配置所需要的基本节点和属性构造,但是对于初学者的我们在编写程序的时候,往往对这些节点的位置和属性不是特别清楚,所以就导致我们的因配置文件错误而不能运行服务程 ...

  4. WCF系列教程之WCF服务配置工具

    本文参考自http://www.cnblogs.com/wangweimutou/p/4367905.html Visual studio 针对服务配置提供了一个可视化的配置界面(Microsoft ...

  5. 2 WCF里面配置的含义

    1 首先介绍所谓的a,b,c. a就是address 地址: b binding 绑定的协议 譬如http  tcp udp 利用这些协议方式请求address: c contract  代表请求的规 ...

  6. WCF学习之旅—WCF服务配置(十四)

    一.概述 我们在前面章节中讲了寄宿,在前面的实例中也用到了配置文件,这一篇主要讲讲如何在应用配置文件,提高WCF程序的灵活性.在编写WCF服务应用程序时,编写配置项也是其中一项主要工作,在前面的几个示 ...

  7. Wcf:可配置的服务调用方式

    添加wcf服务引用时,vs.net本来就会帮我们在app.config/web.config里生成各种配置,这没啥好研究的,但本文谈到的配置并不是这个.先看下面的图: 通常,如果采用.NET的WCF技 ...

  8. WCF HTTPS配置

    昨天需要把做好的一个wcf服务发布到服务器站点下的一个虚拟目录中发布过程遇到了一个问题:服务器上的环境是https,因此需要多对配置文件修改于是在网上找啊找,遇到一个问题找一个问题,可是问题依然没解决 ...

  9. WCF系列教程之WCF服务配置

    文本参考自:http://www.cnblogs.com/wangweimutou/p/4365260.html 简介:WCF作为分布式开发的基础框架,在定义服务以及消费服务的客户端时可以通过配置文件 ...

随机推荐

  1. Mac OSX 无法SSH远程的原因

    在mac中开启了远程共享,拿windows上的putty 死活无法ssh上去. 后来下载了个新版的putty, 连上了.

  2. iOS开发拓展篇—UIDynamic(重力行为+碰撞检测)

    iOS开发拓展篇—UIDynamic(重力行为+碰撞检测) 一.重力行为 说明:给定重力方向.加速度,让物体朝着重力方向掉落 1.方法 (1)UIGravityBehavior的初始化 - (inst ...

  3. Rhel6-varnish配置文档

    系统环境: rhel6 x86_64 iptables and selinux disabled 主机: 192.168.122.160:virnish apache server60.example ...

  4. matplotlib画图保存

    import numpy as np import matplotlib.pyplot as plt xData = np.arange(0, 10, 1) yData1 = xData.__pow_ ...

  5. 315Mhz、433Mhz无线遥控信号的解码分析和模拟

    摘要 前段时间学习无线电的同时了解到arduino是作为技能尚未成熟技术宅的我继树莓派又一个不错的选择.于是花了200元购得3块arduino开发板(2*nano&1*uno)和其他传感器等, ...

  6. UE4 在C++ 动态生成几何、BSP体、Brush ---- Mesh_Generation

    截至UE4  4.10 runtime 无法生成BSP类 ,只能通过自定义的Mesh的Vertex 进行绘制 ( Google 考证,能改UE4源码的请忽略 ) 可用到的 UE4 集成的Render ...

  7. Python控制语句

    1.结构化程序设计 结构化程序设计包含三种基本结构:顺序结构.选择结构.循环结构. 1)顺序结构 如图所示,虚线框内是一个顺序结构:其中A和B两个框是顺序执行的,即在执行完A框所指定的操作后,必然接着 ...

  8. 3、JS中的语句

    1.块语句 常用于组合0~多个语句:语法:{语句1;语句2……} *没有块级作用域:如:在for循环里面定义一个自增数 i,可以在for循环外取到它跳出循环时的值,而且for循环里面新定义的数据也能取 ...

  9. [GodLove]Wine93 Tarining Round #2

    比赛链接: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=44704#overview 题目来源: ZOJ Monthly, June 2 ...

  10. 多个微信菜单都需要获取openId的时候如何处理回调页面的问题

    1.要建立一个特殊的页面处理这个逻辑 if (taskClassId == "6027") { Response.Redirect("./ProductAdvice.as ...