Error when Behaviour Extension types are not fully qualified
April 23, 2008 at 12:58 pm | In WCF | Leave a CommentCustom behaviour extensions are a great way to customise service behaviour such as implementing exception shielding as described here in Rory’s post or message validation using the Microsoft Enterprise Library Validation Application block.
I recently implemented a custom WCF behaviour extension for shielding exceptions when I came across the following cryptic exception.
“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.”
While the message was somewhat cryptic, it pointed me to the service behaviour were I realised I had specified the incorrect version on the type attribute.
Steps
1. Create new behaviour extension. My extension shielded and traced certain exceptions using the IErrorHandler.
2. Use SVC Configuration Editor to plug the extension in. It added the following configuration as expected.
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name=“ErrorHandlerBehavior“
type=“Wcf.Demo.Service.ErrorHandlerElement, Wcf.Demo.Service,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null“ />
</behaviorExtensions>
</extensions>
</system.serviceModel>
3. Ran integration unit tests that passed.
4. The service build was integrated into TeamBuild which happen to automatically update my AssemblyInfo version files.
5. As soon as a TeamBuild kicked off and the assembly version changed, I received the cryptic error.
6. I realised I had an incorrect version configured in the web.config so I replaced the fully qualified type with:
<behaviorExtensions>
<add name=“ErrorHandlerBehavior“
type=“Wcf.Demo.Service.ErrorHandlerElement, Wcf.Demo.Service“ />
</behaviorExtensions>
7. Ran tests and failed.
After attempting to diagnose the issue using tools such as Fusion Log Viewer, I checked Google (which I should have done first) and came across several posts also identifying the issue – including a closed and unresolved issue on Microsoft Connect. This is the second time round I have been to Microsoft Connect regarding a bug and it does not look like they will resolve this anytime soon.
A Way Forward
At this stage since there is no fix, a tedious workaround will have to be to get TeamBuild to modify the web.config and update the version number of the behaviour extension when applying a new version – which in my case is for every CI build triggered by a code checkin.
Links
- Mitch Denny has a good blog post/rant on this here.
- Microsoft Connect issue was raised but it was interestingly closed.
- Keyvan also reports the problem here.
No Comments Yet »
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.