Defines a binding that is secure, reliable, optimized for on-machine cross process communication. By default, it generates a runtime communication stack with WS-ReliableMessaging for reliability, transport security for transfer security, named pipes for message delivery, and binary message encoding.
<netNamedPipeBinding> <binding closeTimeout="TimeSpan" hostNameComparisonMode="StrongWildCard/Exact/WeakWildcard" maxBufferPoolSize="Integer" maxBufferSize="Integer" maxConnections="Integer" maxReceivedMessageSize="Integer" name="string" openTimeout="TimeSpan" receiveTimeout="TimeSpan" sendTimeout="TimeSpan" transactionFlow="Boolean" transactionProtocol="OleTransactions/WS-AtomicTransactionOctober2004" transferMode="Buffered/Streamed/StreamedRequest/StreamedResponse" <security mode="None/Transport"> <transport protectionLevel="None/Sign/EncryptAndSign" /> </security> <readerQuotas maxArrayLength="Integer" maxBytesPerRead="Integer" maxDepth="Integer" maxNameTableCharCount="Integer" maxStringContentLength="Integer" /> </binding> </netNamedPipeBinding>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements
Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type T:System.ServiceModel.HostnameComparisonMode, which indicates whether the hostname is used to reach the service when matching on the URI. The default value is F:System.ServiceModel.HostnameComparisonMode.StrongWildcard, which ignores the hostname in the match.
An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.
A positive integer that specifies the maximum size, in bytes, of the buffer used to store messages in memory. If the buffer is full, excess data remains in the underlying socket until the buffer has room again. This value cannot be less than maxReceivedMessageSize attribute. The default is 65536. For more information, see MaxBufferSize.
An integer that specifies the maximum number of outbound and inbound connections the service will create/accept. Incoming and outgoing connections are counted against a separate limit specified by this attribute.
Inbound connections in excess of the limit are queued until a space below the limit becomes available.
Outbound connections in excess of the limit are queued until a space below the limit becomes available.
The default is 10.
A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.
A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see Simplified Configuration and Simplified Configuration for WCF Services.
A Boolean value that specifies whether the binding supports flowing WS-Transactions. The default is false.
Specifies the transaction protocol to be used with this binding. Valid values are
The default is OleTransactions. This attribute is of type TransactionProtocol.
A TransferMode value that specifies whether messages are buffered or streamed or a request or response.
Defines the security settings for the binding. This element is of type NetNamedPipeBindingElement.
Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type XmlDictionaryReaderQuotasElement.
This element holds a collection of standard and custom bindings.
The NetNamedPipeBinding generates a run-time communication stack by default, which uses transport security, named pipes for message delivery, and a binary message encoding. This binding is an appropriate Windows Communication Foundation (WCF) system-provided choice for on-machine communication. It also supports transactions.
The default configuration for the NetNamedPipeBinding is similar to the configuration provided by the NetTcpBinding, but it is simpler because the WCF implementation is only meant for on-machine use and consequently there are fewer exposed features. The most notable difference is that the securityMode setting only offers the None and Transport options. SOAP security support is not an included option. The security behavior is configurable using the optional securityMode attribute.
The following example demonstrates the netNamedPipeBinding binding, which provides cross-process communication on the same machine. Named pipes do not work across machines.
The binding is specified in the configuration files for the client and service. The binding type is specified in the binding attribute of the <endpoint> element. If you want to configure the netNamedPipeBinding binding and change some of its settings, you must define a binding configuration. The endpoint must reference the binding configuration by name with a bindingConfiguration attribute. In this example, the binding configuration is named Binding1.
<configuration> <system.serviceModel> <services> <service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/ServiceModelSamples/service"/> </baseAddresses> </host> <!-- this endpoint is exposed at the base address provided by host: net.pipe://localhost/ServiceModelSamples/service --> <endpoint address="net.pipe://localhost/ServiceModelSamples/service" binding="netNamedPipeBinding" contract="Microsoft.ServiceModel.Samples.ICalculator" /> <!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex --> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <bindings> <netNamedPipeBinding> <binding closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536"> <security mode="Transport"> <transport protectionLevel="EncryptAndSign" /> </security> </binding> </netNamedPipeBinding> </bindings> <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true--> <behaviors> <serviceBehaviors> <behavior name="CalculatorServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>