Question

i am new in wcf so often read many article on wcf from various site. recently i was seeing a wcf chat code and saw the config code difference at service and client end.

is it mandatory that service end & client end config should look similar in terms of config settings.

here i am pasting two config code just tell me why so difference in config setting at service & client end?

service end config details

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <services>
            <service name="ChatSvc.ChatService" behaviorConfiguration="ChatServiceBehavior">
                <endpoint address="net.tcp://localhost:8085/Chat" binding="netTcpBinding" 
                    contract="ChatSvc.IChat" />
                <!--bindingConfiguration="PortSharingBinding"-->

                <endpoint address="net.tcp://localhost:8085/Chat/mex"
                          binding="mexTcpBinding" contract="IMetadataExchange"/>
            </service>
        </services>
        <!--<bindings>
            <netTcpBinding>
                <binding name="PortSharingBinding" portSharingEnabled="true">
                    <security mode="None"/>
                </binding>
            </netTcpBinding>
        </bindings>-->
        <behaviors>
            <serviceBehaviors>
                <behavior name="ChatServiceBehavior">
                    <serviceMetadata httpGetEnabled="false"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>

client end config details

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Off, 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="d:\cs\cs 4\cs 4-1\work\ChatApplication_FT - ChunkedBufferedFT\simpleclient\TracingFiles\app_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="Timestamp, Callstack">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>
  <system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="false" logMessagesAtServiceLevel="false"
        logMessagesAtTransportLevel="false" />
    </diagnostics>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_IChat" 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="67108864"
          maxBufferSize="524288" maxConnections="100" maxReceivedMessageSize="524288">
          <readerQuotas maxDepth="32" maxStringContentLength="268435456"
            maxArrayLength="67108864" maxBytesPerRead="67108864" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="20:00:10"
            enabled="true" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign">
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
            <message clientCredentialType="Windows" />
          </security>
        </binding>
        <binding name="NetTcpBinding_IChat1" 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="524288"
          maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="20:00:10"
            enabled="true" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign">
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://localhost:8085/Chat" binding="netTcpBinding"
        bindingConfiguration="NetTcpBinding_IChat" contract="ChatSvc.IChat"
        name="NetTcpBinding_IChat" />
    </client>
  </system.serviceModel>
</configuration>

now my question is that there is so many setting at client end but there is little setting at service end.....how is it possible. does the service works properly?

i am new in wcf. so please guide me in details. thanks.

Was it helpful?

Solution

Most of the excess in the client config just means that WCF diagnostics have at one point been enabled for the client.

For instance, the whole <system.diagnostics> section on the client configuration is entirely optional and can be removed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top