views:

84

answers:

2

I had a problem with WCF test, and the problem was solved when I moved to the top of system.servicemodel. My question is, why does this matter? Doesn't .NET read the XML by the field names?

 <system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServiceTypeBehaviors">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <!-- Server-->
    <binding
      name="ws"
      transferMode="Streamed"
      messageEncoding="Mtom"
      maxReceivedMessageSize="10067108864"
      maxBufferSize="500000"
      maxBufferPoolSize="500000"
      receiveTimeout="10:00:00"
      sendTimeout="10:00:00"
      closeTimeout="10:00:00"
      openTimeout="10:00:00">
      <readerQuotas
        maxDepth="32"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="4096"
        maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None"/>
      </security>
    </binding>

    <!-- Server -->
      <binding 
        name="FileTransferServicesBinding" 
        transferMode="Streamed" 
        messageEncoding="Mtom" 
        maxReceivedMessageSize="10067108864" 
        maxBufferSize="500000" 
        maxBufferPoolSize="500000">
        <readerQuotas 
          maxDepth="32" 
          maxStringContentLength="655360" 
          maxArrayLength="655360" 
          maxBytesPerRead="4096" 
          maxNameTableCharCount="16384" />
      </binding>

  </basicHttpBinding>
</bindings>

<!-- Server -->
<services>
  <service behaviorConfiguration="MyServiceTypeBehaviors" name="Namespace.Namespace">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="FileTransferServicesBinding" contract="Namespace.INamespaceSC" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8081/Namespace" />
      </baseAddresses>
    </host>
    <endpoint address="mex" binding="mexHttpBinding" contract="Namespace.INamespaceSC" />
  </service>
</services>

<!-- Behaviors field was here before, when it didn't work -->

<!-- Client -->
<client>
  <endpoint
    address="http://localhost:8081/Namespace"
    binding="basicHttpBinding"
    bindingConfiguration="ws"
    contract="Namespace.INamespaceSC"
   />
</client></system.serviceModel>
A: 

I don't think the order matters! I've developed a lot of WCF services and have never seen such behavior...

Pavel Nikolov
A: 

The order only matters when it comes to service or endpoint configurations and you are not naming the configuration to use. In that case WCF will use the top matching configuration.

I see no reason moving the behaviors section would make any difference. I often have them somewhere near the bottom.

Maurice
They are all named.
Tuoski