-
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 + "
" + "传真:" + fax);
-
相关阅读:
无人转会申请
【Alpha】“北航社团帮”小程序v1.0项目展示
【Alpha】“北航社团帮”小程序v1.0测试报告
【Alpha】“北航社团帮”小程序v1.0发布声明
【Alpha】Scrum meeting 10
编译原理:文法和语言总结与梳理
编译原理:语法树,短语,直接短语,句柄
编译原理:理解文法和语文
编译原理:了解编译原理
MySQL8版本的安装与卸载教程
-
原文地址:https://www.cnblogs.com/tonykan/p/4459390.html
Copyright © 2020-2023
润新知