Problem recognizing behavior extensions in web config

Discussion in 'ASP .Net Web Services' started by Paul Speranza, Nov 19, 2008.

  1. Can anyone tell me what is wrong with this config? When I set up the behavior
    to use the element

    <loggableWCFErrorHandler />

    The editor does not recongize it as a valid element.

    The element 'behavior' has invalid child element 'loggableWCFErrorHandler'.
    List of possible elements expected: 'serviceAuthorization,
    serviceCredentials, serviceMetadata, serviceSecurityAudit, serviceThrottling,
    dataContractSerializer, serviceDebug, serviceTimeouts, persistenceProvider,
    workflowRuntime'.

    I get this warning and of course my code does not work. I have looked at
    every extension sample and can see nothing wrong. I am using VS 2008 with all
    serice packs under XP.


    <system.serviceModel>
    <services>
    <service behaviorConfiguration="MyServiceBehavior"
    name="MyService">
    <endpoint address="" binding="wsHttpBinding" contract="IMyService">
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
    </service>
    </services>
    <behaviors>
    <serviceBehaviors>
    <behavior name="MyServiceBehavior">
    <loggableWCFErrorHandler />
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <extensions>
    <behaviorExtensions>
    <add name="loggableWCFErrorHandler"

    type="My.Handlers.LoggableWCFErrorHandlerBehaviorExtensionElement,
    My.Handlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </behaviorExtensions>
    </extensions>
    </system.serviceModel>
    Paul Speranza, Nov 19, 2008
    #1
    1. Advertising

  2. Paul Speranza

    Guest

    I had a very similar issue trying to set up Message Inspectors in .NET
    3.5 and WCF (Seems all the samples are on .NET 2.0 and all produce the
    warning).
    Although my config file also produces a warning telling me the
    'behaviour' element has an invalid child element, my code works; So
    I'm assuming that this is just a glitch somewhere..
    My warning reads:"The element 'behavior' has invalid child element
    'Actual.Service.Extension'. List of possible elements expected:
    'clientVia, callbackDebug, callbackTimeouts, clientCredentials,
    transactedBatching, dataContractSerializer, synchronousReceive,
    enableWebScript, webHttp'."

    Your config file doesn't seem to contain 'endpointBehaviors' section,
    which could be your issue or give you something else to look at...
    Here is my configuration that works for my message inspectors...

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.serviceModel>

    <services>
    <service name="ActualService.Service"
    behaviorConfiguration="ActualService.Service.Behaviour" >
    <host>
    <baseAddresses>
    <add baseAddress = "http://localhost:8731/Service" />
    </baseAddresses>
    </host>
    <endpoint address="" binding="wsHttpBinding"
    contract="ActualService.IService"
    behaviorConfiguration="ActualService.Service.EndPoint.Behaviour" />
    </service>
    </services>

    <behaviors>
    <serviceBehaviors>
    <behavior name="ActualService.Service.Behaviour">
    <serviceMetadata httpGetEnabled="True" />
    <serviceDebug includeExceptionDetailInFaults="True" />
    </behavior>
    </serviceBehaviors>

    <endpointBehaviors>
    <behavior name="ActualService.Service.EndPoint.Behaviour">
    <Actual.Service.Extension displayData="True"/>
    </behavior>
    </endpointBehaviors>
    </behaviors>

    <extensions>
    <behaviorExtensions>
    <add name="Actual.Service.Extension"
    type="ServiceInspectors.ServiceExtensionElement, ServiceInspectors,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </behaviorExtensions>
    </extensions>

    </system.serviceModel>
    </configuration>

    On Nov 19, 8:33 pm, Paul Speranza
    <> wrote:
    > Can anyone tell me what is wrong with this config? When I set up the behavior
    > to use the element
    >
    >     <loggableWCFErrorHandler />
    >
    > The editor does not recongize it as a valid element.
    >
    > The element 'behavior' has invalid child element 'loggableWCFErrorHandler'.
    > List of possible elements expected: 'serviceAuthorization,
    > serviceCredentials, serviceMetadata, serviceSecurityAudit, serviceThrottling,
    > dataContractSerializer, serviceDebug, serviceTimeouts, persistenceProvider,
    > workflowRuntime'.
    >
    > I get this warning and of course my code does not work. I have looked at
    > every extension sample and can see nothing wrong. I am using VS 2008 withall
    > serice packs under XP.
    >
    >   <system.serviceModel>
    >     <services>
    >       <service behaviorConfiguration="MyServiceBehavior"
    >         name="MyService">
    >         <endpoint address="" binding="wsHttpBinding" contract="IMyService">
    >           <identity>
    >             <dns value="localhost" />
    >           </identity>
    >         </endpoint>
    >         <endpoint address="mex" binding="mexHttpBinding"
    > contract="IMetadataExchange" />
    >       </service>
    >     </services>
    >     <behaviors>
    >       <serviceBehaviors>
    >         <behavior name="MyServiceBehavior">
    >           <loggableWCFErrorHandler />
    >           <serviceMetadata httpGetEnabled="true" />
    >           <serviceDebug includeExceptionDetailInFaults="false" />
    >         </behavior>
    >       </serviceBehaviors>
    >     </behaviors>
    >     <extensions>
    >       <behaviorExtensions>
    >         <add name="loggableWCFErrorHandler"
    >
    > type="My.Handlers.LoggableWCFErrorHandlerBehaviorExtensionElement,
    > My.Handlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    >       </behaviorExtensions>
    >     </extensions>
    >   </system.serviceModel>
    , Dec 9, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Thompson

    Servlet container not recognizing WEB-INF

    Andrew Thompson, Aug 5, 2004, in forum: Java
    Replies:
    11
    Views:
    912
    Andrew Thompson
    Sep 21, 2004
  2. Asra
    Replies:
    1
    Views:
    4,313
    Sudsy
    Oct 26, 2004
  3. John Gonsalves
    Replies:
    15
    Views:
    721
    Alexey Smirnov
    Apr 9, 2007
  4. CSharpner
    Replies:
    0
    Views:
    1,021
    CSharpner
    Apr 9, 2007
  5. Raymond Chiu

    system.web.extensions not appear in web.config

    Raymond Chiu, Apr 8, 2008, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    173
    Raymond Chiu
    Apr 8, 2008
Loading...

Share This Page