Problem recognizing behavior extensions in web config


P

Paul Speranza

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>
 
Ad

Advertisements

T

TheLazyLizzard

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top