What is the difference between binding configuration and Behavior?

I am trying to get WCF configuration files better, so I can more easily work on more complex scripts. As usual, I am revising my understanding of the basics. So the question is: What is the difference between binding configuration and behavior? I am not asking what binding is (i.e. netTcpBinding , etc.). I understand.

So, let's say I have a configuration file with several configurations for this single binding:

  <netTcpBinding> <binding name="LargeMessages" maxBufferPoolSize="5242880" maxBufferSize="5242880" maxReceivedMessageSize="5242880"> <readerQuotas maxDepth="256" maxStringContentLength="16384" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"></security> </binding> <binding name="LargeFiles" maxBufferPoolSize="15728640" maxBufferSize="15728640" maxReceivedMessageSize="15728640"> <!-- 15MB max size --> <readerQuotas maxDepth="256" maxStringContentLength="15728640" maxArrayLength="15728640" maxBytesPerRead="204800" maxNameTableCharCount="15728640" /> <security mode="None"></security> </binding> <binding name="LargeStrings" maxBufferPoolSize="524288" maxBufferSize="524288" maxReceivedMessageSize="524288"> <!-- 0.5MB max size --> <readerQuotas maxDepth="256" maxStringContentLength="524288" maxArrayLength="524288" maxBytesPerRead="204800" maxNameTableCharCount="524288" /> <security mode="None"></security> </binding> </netTcpBinding> 

In this case, I call LargeMessages , LargeFiles and LargeStrings โ€œLink Configurationsโ€.

Now that I have this config, I can also have several Behaviors where one could look like this:

 <behavior name="DefaultServiceBehavior"> <serviceCredentials> <serviceCertificate findValue="1234123412341234123412341234" x509FindType="FindByThumbprint" /> </serviceCredentials> <serviceMetadata/> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> 

In this case, DefaultServiceBehavior is the behavior.

So another way to ask your question is: Why can't my snap setting contain all my settings set by my Behavior? Or vice versa? At a basic and high level, why do we have both sets of settings? It seems that both can very significantly affect my transport configuration or my message configuration. I just do not see the logic of separation of settings.

+4
source share
1 answer

In technical terms:

  • Bindings : used to indicate transport, coding, and protocol information needed by clients and services to communicate with each other.
  • Behavior : these are types that modify or extend the functionality of a service or client.

In the conditions of a layman:

  • Bindings : used to indicate the language your services speak (e.g. English, Portuguese, etc.). The service and the client can only communicate with each other if they agree to speak the same language.
  • Behavior : Used to determine how your service should act. For example, the British Royal Guard is expected to stand perfectly calm during duty, because the way they dictate the protocol, they must act, otherwise people may doubt that they are truly British guardians.

Conclusion, your services must speak the appropriate language (mandatory) and act (behavior), as they must otherwise customers may have difficulty trying to communicate with them.

+7
source

All Articles