none
Unrecognized attribute 'behaviorConfiguration' RRS feed

  • General discussion

  • Hi,

    I have a problem with microsoft.web.administration when I try to access the web.config of my WCF

    I've done a lot of search on this forum and tried a lot of things. My application pool use the Framework 4.0, as well as my WCF. 

    Web.Config

    <system.serviceModel>
        <services>
          <service behaviorConfiguration="WindowsAuthenticationBehavior"
                   name="X111.WCFI.NomProjet.DemandeRelationClientele">
            <endpoint address=""
                      binding="basicHttpBinding" 
                      bindingConfiguration="basicHttpBinding_Windows"     
                      contract="X111.WCFC.NomProjet.IDemandeRelationClientele">
            </endpoint>
          </service>
        </services>

    ...

    In the code

    ConfigurationSection section = config.GetSection("system.serviceModel/services/service/endpoint");

    ConfigSections in the Machine.Config


    <sectionGroup name="services" type="System.ServiceModel.Configuration.ServicesSection , System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <sectionGroup name="service" type="System.ServiceModel.Configuration.ServicesElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
              <section name="endpoint" type="System.ServiceModel.Configuration.ServiceEndpointElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </sectionGroup>
    </sectionGroup>

    Someone can help me with this ?

    Thanks

    Monday, September 22, 2014 12:14 PM

All replies

  • Hi,

    For this situation, you could check whether there is the <behaviors> section within your web.config file and there have to be a serviceBehaviors section with the behavior name is WindowsAuthenticationBehavior.

    There are 3 important sections when you configure a WCF service.

    1) Defining the Services:

    <services>
          <service behaviorConfiguration="SOAPRESTDemoBehavior" name="SOAPRESTDemo">
            <endpoint address="rest" behaviorConfiguration="SOAPRESTDemoEndpointBehavior" binding="webHttpBinding" contract="ISOAPRESTDemo" />
            <endpoint address="soap" binding="basicHttpBinding" contract="ISOAPRESTDemo" />
          </service>
        </services>

    NOTE the value of behaviorConfiguration is a reference to a section further on in the config see below...

    2) Defining the 'Service Behaviours'

     <serviceBehaviors>
            <behavior name="SOAPRESTDemoBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>

    3) Defining the 'Endpoint Behaviours'

    <endpointBehaviors>
            <behavior name="SOAPRESTDemoEndpointBehavior">
              <webHttp/>
            </behavior>
          </endpointBehaviors>

    All 3 sections are the basics for what you need to set up a service (although this can be done programatically).

    For more information about behaviorConfiguration:

    http://stackoverflow.com/questions/6453841/what-is-the-behaviorconfiguration-attribute-of-service

    Regards

    Tuesday, September 23, 2014 2:08 AM
    Moderator
  • I have this section

    Here is my complete web.config, everything work fine except when I add the section in the configSections of my machine.config

    Complete web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
      </system.web>
      <system.serviceModel>
        <services>
          <service behaviorConfiguration="WindowsAuthenticationBehavior" 
                   name="X111.ITSV.Client.DemandeRelationClientele">
            <endpoint address=""
                      binding="basicHttpBinding" 
                      bindingConfiguration="basicHttpBinding_Windows"     
                      contract="X111.ITSV.Contrats.IDemandeRelationClientele">
            </endpoint>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WindowsAuthenticationBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <serviceCredentials>
                <windowsAuthentication includeWindowsGroups="true" allowAnonymousLogons="false" />
              </serviceCredentials>
              <serviceAuthorization serviceAuthorizationManagerType="M201.DA.CTRL.ControlAutGen.AutoriserAcces, M201Z1_02_C_ControlAutGen_PC , Version=014.011.014.012, Culture=neutral, PublicKeyToken=e279ce048df015ae" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <bindings>
          <basicHttpBinding>
            <binding name="basicHttpBinding_Windows" closeTimeout="00:01:00"
                 openTimeout="00:01:00" receiveTimeout="00:25:00" sendTimeout="00:25:00"
                 allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                 maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                 useDefaultWebProxy="true">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings> 
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            Pour parcourir le répertoire racine de l'application Web lors du débogage, définissez la valeur ci-dessous sur true.
            Définissez-la sur false avant le déploiement pour ne pas divulguer d'informations du dossier de l'application Web.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>
      <system.web.extensions>
        <scripting>
          <webServices>
            <authenticationService />
          </webServices>
        </scripting>
      </system.web.extensions>
    </configuration>

    ConfigSections of my Machine.config

    Functional:

    <section name="services" type="System.ServiceModel.Configuration.ServicesSection , System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    Not functional : 

    <sectionGroup name="services" type="System.ServiceModel.Configuration.ServicesSection , System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <sectionGroup name="service" type="System.ServiceModel.Configuration.ServicesElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
              <section name="endpoint" type="System.ServiceModel.Configuration.ServiceEndpointElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </sectionGroup>
    < /sectionGroup>


    • Edited by Sebx81 Tuesday, September 23, 2014 1:04 PM
    Tuesday, September 23, 2014 1:02 PM