Click here to Skip to main content
15,886,724 members
Articles / Programming Languages / XML

NullTransport for WCF

Rate me:
Please Sign up or sign in to vote.
4.91/5 (48 votes)
1 Oct 200712 min read 189.3K   1.7K   121  
This article describes design, implementation and the usage of the custom in-process transport for Microsoft Windows Communication Foundation (WCF) model.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <!--<system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"
        propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="c:\logs\nullchannel\test\app_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="LogicalOperationStack, Timestamp, ThreadId, Callstack">
        <filter type="" />
      </add>
      <add initializeData="c:\logs\nullchannel\test\app_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelMessageLoggingListener" traceOutputOptions="LogicalOperationStack, Timestamp, ThreadId, Callstack">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>-->

  <system.serviceModel>
    <diagnostics performanceCounters="Off">
      <messageLogging logMalformedMessages="false" logMessagesAtServiceLevel="false"
        logMessagesAtTransportLevel="false" />
    </diagnostics>

    <extensions>
      <bindingElementExtensions>
        <add name="nullTransport" type="RKiss.NullChannelLib.NullTransportElement, NullChannelLib" />
      </bindingElementExtensions>
      <behaviorExtensions>
        <add name="logger" type="RKiss.Logger.LoggerBehaviorSection, Logger, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
      </behaviorExtensions>
    </extensions>

    <bindings>
      <customBinding>
        <binding name="NewBinding0">
          <transactionFlow/>
          <nullTransport />
          <!--<namedPipeTransport/>-->
        </binding>
      </customBinding>
      <msmqIntegrationBinding>
        <binding name="NewBinding1" >
          <security mode="None" />
        </binding>
      </msmqIntegrationBinding>
    </bindings>

    <services>
      <service name="Host4.Test" behaviorConfiguration="logmessages">
        <endpoint address="net.null://localhost/gaga" binding="customBinding" bindingConfiguration="NewBinding0" contract="Host4.ITest" />
      </service>
      <service name="Host4.TestQueue">
        <endpoint address="msmq.formatname:DIRECT=OS:.\private$\test" binding="msmqIntegrationBinding" bindingConfiguration="NewBinding1" contract="Host4.ITestQueue" />
       </service>
    </services>
    
    <client>
      <endpoint name="gaga" address="net.null://localhost/gaga" binding="customBinding" bindingConfiguration="NewBinding0" contract="Host4.ITest" behaviorConfiguration="logmessages"/>
    </client>

    <behaviors>
      <endpointBehaviors>
        <behavior name="logmessages">
          <logger enable="true" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="logmessages">
          <logger enable="true" logAfterReceiveRequest="true" logBeforeSendReply="true"/>
          <serviceCredentials>
            <windowsAuthentication allowAnonymousLogons="false" includeWindowsGroups="true" />
          </serviceCredentials>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions