Menu Home

70-513 Windows Communication Foundation 4, Reading material

During my Christmas vacation I have been preparing for the Windows Communication Foundation Development with Microsoft .NET Framework 4, as part of a quest at work to have four people obtain the Windows Azure Developer title, which in return will grant us some partner benefits.

I have previously been preparing for the WCF certification, but as I find the topic super boring (although very useful) I never actually took the exam, but since the upside is bigger this time I will take the exam.

Before I started on reading up, I had a decent amount of real-life experience with WCF (without being an expert), so if you are a complete beginner this reading material might not be sufficient.

Anyway my reading material has been:

I was finally able to take the exam today after it got rescheduled a week – and yeah I passed. The extra week was great because there is a lot of material, and a lot of stuff to remember, even if you have worked with WCF for a while. After the exam I still feel like I can improve in some areas I purposely didn’t spend too much time on during the preparation. So when I feel like reading more WCF, I will dive deeper into the security aspects and routing.

Personal notes

ServiceBehaviorAttribute.InstanceContextMode defaults to PerSession, other options are: Single (only one instance of service exists unless ConcurrencyMode equals Multiple), PerCall (new instance of services is created for each request).

Default values for the realiableSession binding element.
<bindings>
<customBinding>
<binding>
<reliableSession
acknowledgementInterval="2"
flowControlEnabled="true"
inactivityTimeout="00:10:00"
maxPendingChannels="4"
maxRetryCount="8"
maxTransferWindowSize="32"
ordered="false"
reliableMessagingVersion="WSReliableMessagingFebruary2005"/>
</binding>
</customBinding>
</bindings>

When creating custom bindings the order of the binding elements are important read more here,

Custom Bindings

  • Transaction Flow (Not Required)
  • Reliable Messaging (Not Required)
  • Message Security (Not Required)
  • Composite Duplex (Not Required)
  • Message Encoding (Required)
  • Transport Security (Not Required)
  • Transport (Required)

Possible transport protocols:

If message contracts are used they must be used for both request and reply. Message contract provides more control of the SOAP message making it possible to define which fields go in the header, with MessageHeader attribute and MessageBodyMember for fields that must go in the SOAP body.

Routing

the Routing Service evaluates all filters at the highest priority level first

Diagnostics

logEntireMessage defaults to false, when set to true body is logged also.
<system.serviceModel>
<diagnostics>
<endToEndTracing activityTracing="true" propagateActivity="true"></endToEndTracing>
<messageLogging logKnownPii="true" logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"></messageLogging>
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"></add>
</listeners>
</source>
<source name="CardSpace">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IO.Log">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.Runtime.Serialization">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IdentityModel">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>

<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\log\Traces.svclog" />
</sharedListeners>

Behaviors

The WebHttpBehavior is a general-purpose behavior that supports UriTemplate dispatch and POX/JSON/byte stream formats on the wire. Use it for general purpose HTTP/REST/Web-Style services.

The WebScriptEnablingBehavior is a “profile” of the WebHttpBehavior functionality designed specifically for interop with ASP.NET AJAX clients. It adds in some AJAX-isms like the ability to automatically generate ASP.NET AJAX client proxies.
Source

Contracts

The following operationcontract is allowed to declared private. And the exception will not be returned to the sender.

[ServiceContract]
public class OneWay
{
[OperationContract(IsOneWay=true)]
private void DoWork(DataStore ds)
{
throw new Exception(“error”);
}
}

Rules for orderings:

  • If a data contract type is a part of an inheritance hierarchy, data members of its base types are always first in the order.
  • Next in order are the current type’s data members that do not have the Order property of the DataMemberAttribute attribute set, in alphabetical order.
  • Next are any data members that have the Order property of the DataMemberAttribute attribute set. These are ordered by the value of the Order property first and then alphabetically if there is more than one member of a certain Order value. Order values may be skipped.

Categories: Software

Simon J.K. Pedersen

Leave a Reply

Your email address will not be published. Required fields are marked *