WCF transmits data between server-side servers and client servers through the net TCP protocol, noting configuration considerations

Source: Internet
Author: User

1. Pay special attention to the binding name= "bindingbehaviorconfiguration" ( name can be arbitrarily taken, but must be consistent between the server and the client )

bindingconfiguration= "bindingbehaviorconfiguration"

How to not configure consistency: The server has denied client credentials

If there is no configuration: Security mode= "None", the behavior occurs: The server has denied client credentials

----Server-side Configuration example:

<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<startup>
<supportedruntime version= "v4.0" sku= ". netframework,version=v4.5 "/>
</startup>

<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name= "bindingbehaviorconfiguration"Maxbufferpoolsize=" 52428800 "
Maxbuffersize= "6553600" maxreceivedmessagesize= "6553600" portsharingenabled= "true" >
<readerquotas maxstringcontentlength= "6553600"/>
<security mode= "None"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name= "CDAgentWCF.Services.CDAgentWCFService" behaviorconfiguration= " CDAgentWCF.Services.CDAgentWCFServiceBehavior ">
<baseAddresses>
<add baseaddress= "NET.TCP://LOCALHOST:9999/CDAGENTWCF"/>
<add baseaddress= "Http://localhost:9998/CDAgentWCF"/>
</baseAddresses>
<endpoint address= "Propellingservice"
Binding= "NetTcpBinding"
contract= "CDAgentWCF.Services.ICDAgentWCFService" bindingconfiguration= "bindingbehaviorconfiguration"/>
<endpoint address= "Mex"
Binding= "mexHttpBinding"
contract= "IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name= "CDAgentWCF.Services.CDAgentWCFServiceBehavior" >
<servicemetadata httpgetenabled= "True"/>
<servicedebug includeexceptiondetailinfaults= "False"/>
<datacontractserializer maxitemsinobjectgraph= "2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>

</system.serviceModel>
</configuration>

Client Configuration instance:

<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<startup>
<supportedruntime version= "v4.0" sku= ". netframework,version=v4.5 "/>
</startup>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name= "bindingbehaviorconfiguration">
<security mode= "None"/>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address= "Net.tcp://192.168.1.88:9999/cdagentwcf/propellingservice"
Binding= "NetTcpBinding"
contract= "Cdagentservice.cdagentwcfservice" bindingconfiguration= "bindingbehaviorconfiguration">
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior>
<datacontractserializer maxitemsinobjectgraph= "2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

WCF transmits data between server-side servers and client servers through the net TCP protocol, noting configuration considerations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.