WCF also provides a higher-level runtime that sits on top of the channel layer, targeted more at the application developer. It is often referred to throughout the WCF documentation as the service model layer. This higher-level runtime consists primarily of a component called the dispatcher (within the context of a service host) and a component called the proxy (within the context of a client).
The dispatcher/proxy combination serves one primary purpose—to translate between WCF Message objects and Microsoft® .NET Framework method calls (see Figure). These components follow a well-defined sequence of steps to perform this process, and at each step along the way they provide extensibility points that you can plug into. You can use these extensibility points to implement a wide variety of custom behaviors including message or parameter validation, message logging, message transformations, custom serialization/deserialization formats, output caching, object pooling, error handling, and authorization, to name a few. Here I'll focus on the implementation of these types of custom behaviors
Figure : WCF Runtime Architecture
When you add a custom behavior to a WCF service to intercept calls before the operation is invoked, you need to add the Fully-Qualified Type Name (FQTN) into the web.config file like the following example.
<behaviorExtensions><add name=”MessageInspector” type=”MessageInspector.MessageInspectorEndpointBehaviour, MessageInspector Version=1.1.0.0, Culture=neutral, PublicKeyToken=2a8e0f2687fa1def″ /></behaviorExtensions>
How to find the Fully Qualified Assembly Name(FQAN) of a GAC registered assembly called 'MessageInspector'?
Command: GACUTIL.EXE /L MessageInspector
Result = MessageInspector, Version=1.1.0.0, Culture=neutral, PublicKeyToken=2a8e0f2687fa1def, processorArchitecture=MSIL
However if you then add the type name to that FQAN, the interceptor fails to execute. Why?
Well see the processor architecture directive at the end? REMOVE IT.
For some reason, Microsoft are doing a string comparison on the FQTN name when determining whether the WCF custom behavior is valid. As a result your WCF services will stop working.
When you add a custom behavior to a WCF service to intercept calls before the operation is invoked, you need to add the Fully-Qualified Type Name (FQTN) into the web.config file like the following example.
<behaviorExtensions><add name=”MessageInspector” type=”MessageInspector.MessageInspectorEndpointBehaviour, MessageInspector Version=1.1.0.0, Culture=neutral, PublicKeyToken=2a8e0f2687fa1def″ /></behaviorExtensions>
How to find the Fully Qualified Assembly Name(FQAN) of a GAC registered assembly called 'MessageInspector'?
Command: GACUTIL.EXE /L MessageInspector
Result = MessageInspector, Version=1.1.0.0, Culture=neutral, PublicKeyToken=2a8e0f2687fa1def, processorArchitecture=MSIL
However if you then add the type name to that FQAN, the interceptor fails to execute. Why?
Well see the processor architecture directive at the end? REMOVE IT.
For some reason, Microsoft are doing a string comparison on the FQTN name when determining whether the WCF custom behavior is valid. As a result your WCF services will stop working.
No comments:
Post a Comment