nam vo
nam vo

Reputation: 3437

wcf strange behaviors

<system.serviceModel>
  <services>
    <service name="Coevery.Services.Document.DocumentService" 
             behaviorConfiguration="aaa">
      <endpoint address="" 
                binding="basicHttpBinding" 
                bindingConfiguration="documentbinding" 
                contract="Coevery.Services.Document.IDocumentService">
      </endpoint>
    </service>
  </services>
  <bindings>
    <basicHttpBinding>
      <binding maxBufferPoolSize="2147483647" 
               maxReceivedMessageSize="2147483647" 
               allowCookies="true">
        <security mode="None">
        </security>
        <readerQuotas maxArrayLength="2147483647" 
                      maxNameTableCharCount="2147483647"
                      maxStringContentLength="2147483647" 
                      maxDepth="2147483647" 
                      maxBytesPerRead="2147483647" />
      </binding>
      <binding name="documentbinding" 
               closeTimeout="04:01:00" 
               openTimeout="04:01:00" 
               receiveTimeout="04:10:00" 
               sendTimeout="04:01:00" 
               allowCookies="false" 
               bypassProxyOnLocal="false" 
               hostNameComparisonMode="StrongWildcard" 
               maxBufferSize="2147483647" 
               maxBufferPoolSize="2147483647" 
               maxReceivedMessageSize="2147483647" 
               messageEncoding="Mtom" 
               textEncoding="utf-8" 
               useDefaultWebProxy="true">
        <readerQuotas maxDepth="2147483647" 
                      maxStringContentLength="2147483647" 
                      maxArrayLength="2147483647" 
                      maxBytesPerRead="2147483647" 
                      maxNameTableCharCount="2147483647" />
      </binding>
    </basicHttpBinding>
  </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior name="aaa">
        <serviceSecurityAudit auditLogLocation="Application" 
                              serviceAuthorizationAuditLevel="Failure"
                              messageAuthenticationAuditLevel="Failure" 
                              suppressAuditFailure="true" />
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
        <serviceMetadata httpGetEnabled="true" />
        <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
        <serviceDebug includeExceptionDetailInFaults="true" />
        <serviceCredentials>
          <serviceCertificate findValue="WCfServer" 
                              storeLocation="LocalMachine" 
                              storeName="TrustedPeople"
                              x509FindType="FindBySubjectName"/>
        </serviceCredentials>
        <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="True" />
</system.serviceModel>

If behavior name="aaa" => Metadata publishing for this service is currently disabled. but without a name then it's ok.

Does anyone know what's wrong with that ? i get lost when using wcf every time :D

Upvotes: 0

Views: 132

Answers (1)

Alex
Alex

Reputation: 8937

It is the feature of WCF 4. When you ommit the name, WCF service considers it a a default behaviour. See http://msdn.microsoft.com/en-us/library/ee354381.aspx:

In WCF 3.x, you have to define named behavior configurations that you explicitly apply to services and endpoints through the “behaviorConfiguration” attribute. With WCF 4, you can define default behavior configurations by omitting the name in the configuration definition. If you add these default behaviors to machine.config, they’ll apply to all services or endpoints hosted on the machine.

Upvotes: 1

Related Questions