Possible Duplicate:
The element ‘behavior’ has invalid child element ‘myFaultExtension’ in wcf app.config
I'm trying to implement Creating and Handling Faults in Silverlight. (This project works on my machine.)
I get a Visual Studio warning:
The element 'behavior' has invalid child element 'betterErrorMessagesFaults'.
Other answers elsewhere say I should just ignore it, but I can't because I'm not able to update the service reference in the non .Web project (the one with all the xaml files). When I try, I get this error:
Parser Error Message: The type 'MyProject.Web.Services.BetterErrorMessagesFaultBehavior, MyProject.Web.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' registered for extension 'betterErrorMessagesFaults' could not be loaded.
Here's the relevant part of Web.config:
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="betterErrorMessagesFaults"
type="MyProject.Web.Services.BetterErrorMessagesFaultBehavior, MyProject.Web.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
<services>
<service name="MyProject.Web.Services.Service2">
<endpoint address="" binding="customBinding"
bindingConfiguration="MyProject.Web.Services.Service2.customBinding0"
contract="MyProject.Web.Services.Service2"
behaviorConfiguration="BetterErrorMessagesFaultBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="BetterErrorMessagesFaultBehavior">
<betterErrorMessagesFaults/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="MyProject.Web.Services.Service2.customBinding0">
<binaryMessageEncoding>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxDepth="2147483647" maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
The BetterErrorMessagesFaultBehavior
is just a copy-paste of the class here on MSDN; with only the name changed (I tried with default name as well), and the namespace changed to MyProject.Web.Services
.
I also tried exchanging
<add name="betterErrorMessagesFaults"
type="MyProject.Web.Services.BetterErrorMessagesFaultBehavior, MyProject.Web.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
with
<add name="betterErrorMessagesFaults"
type="MyProject.Web.Services.BetterErrorMessagesFaultBehavior, MyProject.Web.Services"/>
but there was no effect. I read this is extremely sensitive to spaces etc., but I can't see any problem areas. I also looked at the AssemblyInfo and the version is 1.0.0.0, culture is just blank (""), and I don't know what PublicKeyToken is for, but I suspect that is not the problem here...
So I am stumped, no idea where to look next.