.NET Framework Developer Center > .NET Framework Forums > Windows Communication Foundation (WCF) > 'webHttp' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions

Answered 'webHttp' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions

  • Sunday, December 02, 2007 5:13 AM
     
     
    I am having a problem getting restful services going.  Here is my web.config section:

    Code Block

    <system.serviceModel>
            <behaviors>
                <serviceBehaviors>
                    <behavior name="PVDServices.Service1Behavior">
                        <!-- 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="false"/>
                    </behavior>
                </serviceBehaviors>
                <endpointBehaviors>
                    <behavior name="restBehavior">
              <webHttp/>
                    </behavior>
                </endpointBehaviors>
            </behaviors>
            <services>
                <service name="PVDServices.Services" behaviorConfiguration="PVDServices.Service1Behavior">
                    <endpoint name="REST" binding="webHttpBinding"
                      bindingConfiguration=""
                      contract="PVDServices.IServices" behaviorConfiguration="restBehavior">
                    </endpoint>
                </service>
            </services>
        </system.serviceModel>


    Here is my defined interface:
    Code Block

    namespace PVDServices
    {
        // NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
        [ServiceContract]
        public interface IServices
        {
            [OperationContract, WebGet]
            List<Video> GetVideos(int startIndex, int count);
        }

        [DataContract]
        public class Video
        {
            [DataMember]
            public string ImageUrl { get; set; }
            [DataMember]
            public string Title { get; set; }
        }
    }


    This is the message I am receiving:

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Invalid element in configuration. The extension name 'webHttp' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.

    Any ideas?

Answers

  • Thursday, March 06, 2008 4:11 PM
     
     Answered
    1. Go to C:\WINDOWS\Microsoft.NET\Framework\v3.5
    2. Run WFServicesReg.exe /c

    Enjoy Smile
  • Thursday, March 13, 2008 11:21 PM
     
     Answered

    Add these inside the settings:

     

    <configuration>

    <system.serviceModel>

    <extensions>

    <behaviorExtensions>

    <add name="webHttp" type="System.ServiceModel.Configuration.WebHttpElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    </behaviorExtensions>

    <bindingElementExtensions>

    <add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    </bindingElementExtensions>

    </extensions>

    ...

     

    </configuration>

All Replies

  • Monday, December 03, 2007 9:27 PM
     
     

     

    Can you make sure .NET3.5 is installed properly on your machine? The above error would occur only if .NET3.5 is not installed correctly.
  • Thursday, March 06, 2008 4:11 PM
     
     Answered
    1. Go to C:\WINDOWS\Microsoft.NET\Framework\v3.5
    2. Run WFServicesReg.exe /c

    Enjoy Smile
  • Thursday, March 13, 2008 11:21 PM
     
     Answered

    Add these inside the settings:

     

    <configuration>

    <system.serviceModel>

    <extensions>

    <behaviorExtensions>

    <add name="webHttp" type="System.ServiceModel.Configuration.WebHttpElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    </behaviorExtensions>

    <bindingElementExtensions>

    <add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    </bindingElementExtensions>

    </extensions>

    ...

     

    </configuration>

  • Wednesday, April 06, 2011 12:37 PM
     
     
    1. Go to C:\WINDOWS\Microsoft.NET\Framework\v3.5
    2. Run WFServicesReg.exe /c

    Enjoy Smile

    I'm surpised that no one considering this as the answer. I have done all steps above, except this one and I can never get it to work until I tried this.
    aahkam